User Tools

Site Tools


software:git

git

git is the revision control system which has been adopted to keep track of the AuScope codebase.

A comprehensive reference can be found at the git homepage: http://git-scm.com/.

The quick version:

pull changes down from the central repository (do this before starting your own work.):

git pull origin master

Add a file:

git add <filename/directory>

remove a file:

git rm <filename/directory>

See what changes have been made to the codebase:

git status

commit some changes:

git commit -m "commit message" <files/directories>

Push committed changes up to the central repository (do this after you've finished):

git push origin master

See how you've changed a file:

git diff <filename>

Sometimes (rarely) a repository will get confused. You will see errors like:

error: unable to create temporary sha1 filename .git/objects/95: File exists

This can be corrected by either “chown -R prog .git”, or by the commands:

git fsck
git prune
git repack
git fsck

Sample Usage

First of all: obtain a copy of the codebase. The only dependency is the 'git-core' package (for ubuntu and debian).

git clone ssh://observer@ops-serv2/home/observer/gits/pcfs_prod.git

If we already have a repository, we execute a “pull” to ensure our codebase is current before making any changes.

cd pcfs_prod
git pull origin master

We wish to modify the template station.prc slightly.

cd pcfs_prod/AuscopeUtils/proc
vi station.prc

Having saved our changes, we verify what we have changed, and commit it:

git diff station.prc
git commit -m "Tweaked the doodad." station.prc

Now we push our change back up to the primary repository.

git push origin master.

The modified station.prc can now be retrieved by executing a “git pull” on any other git repository (ie. in the /usr2/AuScopeUtils directories on the remote pcfs machines).

/home/www/auscope/opswiki/data/pages/software/git.txt · Last modified: 2011/10/26 06:37 (external edit)