A guide to git

Git is a powerful version control system. It's distributed, and has lots of good features. However, the interface developed over time, so it's a little bit weird to use. This is a short guide to git.

Throughout, we'll use kiwi as our client computer, and ant as our server. By no means is this the only way of using git; it's just a convenient way that works for me.

These are the available pages:

Some useful features

Here's a list of commands which begin to explain why you'd bother using git:

git log

Show a list of previous commits. Note the long hex code — you can use that to refer to individual commits.

git grep string

Search all tracked files for string.

git diff

Show all changes since the previous commit.

git reset --hard

Blow away all changes since the last commit. (Use caution!)

git diff HEAD~10 file

Show changes to file since 10 commits ago.

git checkout file

Get the version of file that we last committed.

git checkout fa3be file

Get the version of file in commit fa3be. We only need enough characters in the commit id to make it unique.

git checkout fa3be file

Get the version of file in commit fa3be. We only need enough characters in the commit id to make it unique.

git show HEAD^:file

Show the second-to-last committed version of file.

git show fa3be:file

Show the version of file stored in commit fa3be.