A primer on remote branches with Git

Tags:

Here we assume that

  1. You have set up a local working directory to edit the source code of Simutrans-Experimental, your favorite game; and

  2. Tou would like to compile one of the branches to test it.

First, setup git. Now we go get James's repository:

$ git clone https://github.com/jamespetts/simutrans-experimental

List remote branches only:

$ git branch -r

List all remote branches, and lots of other info:

$ git remote show origin

Create a local branch to track a remote branch:

$ git branch --track running-powers origin/running-powers

Have our local working copy, track the named branch:

$ git checkout running-powers

Go get it

$ git pull

Show local branches:

$ git branch
10.x
master
* running-powers

OK let's build that:

$ make -j3
[...]
===> LD build/default/simutrans-experimental

Cool! Now, copy that binary to our games-playing directory:

$ cp -a build/default/simutrans-experimental ~/simutrans/sim-exp/

If some git commands refuse to proceed because they’re worried about clobbering untracked files, and you’re certain that all untracked files and directories are expendable, then delete them mercilessly with:

$ git clean -f -d