Git How to
Table of Contents
This is only a very short introduction to a few git commands, you'll probably also want to read some proper documentation like http://schacon.github.com/git/gittutorial.html, the Github documentation, or one or more from this list: http://sixrevisions.com/resources/git-tutorials-beginners/
Check Your Version
Before you start check the version of git:
git --version
If you do not have at least 1.7 you may run into issues. It is worth trying anyway, even if you don't have 1.7.
Get a Local Copy
git clone git://github.com/Warzone2100/warzone2100.git
You will get the whole repo with all branches with that.
Creating a Local Branch
When you've cloned the repo, do:
git checkout -b --track master origin/master
That will make a local branch for master (you can do the same for qt or any of the others). The --track option might be the default, if not, you can make it default with git config branch.autosetupmerge true.
Switching Branches
Then you can do:
git checkout master
(replace 'master' with the name of the branch you want) to switch branches.
Updating Branches
git pull
will update the currently checked out branch to what is on the server. To get all release tags, do
git fetch --tags
Managing Local Changes
If you have uncommitted local changes, you can "git stash" them, and "git stash pop" after the pull, or do "git checkout -f" to get rid of them.
If you committed your local changes, run:
git pull --rebase
to put them on top of the current revision instead of the one you started from. If you do not rebase, you will create two branches which have to be merged together again. You can make the --rebase option default for new branches with git config branch.autosetuprebase always.
Caution: ONLY rebase commits that are not in the main repository (local or pushed only to your own clone on e.g. Github)! If you have already pushed them to the main repository, use merge instead.
Making Your Local Changes Public
See Commit Guidelines for more information
Bisecting: Finding Bugs
If you know a revision that works, and a revision that's broken, you can find the commit that introduced a problem by bisecting it. See http://book.git-scm.com/5_finding_issues_-_git_bisect.html for details.
