Git cheat sheet
02 Nov 2013
For my first blog post, I’m sharing the Git commands I use most often when setting up a new project. This is mostly here for my own benefit in forgetful moments, but others might find it useful too.
If NameOfRepo.git was a fork, set the upstream:
pull down all remote branches
changing remote url
(So far I’ve only ever used this to switch from https to ssh, or to correct a mistake in a prior
git remote add ... step.)
testing other peoples’ pull requests before merging
(exclude /branchname to get all of their branches)
now run nosetests, etc.
You can rebase against any branch you want, but upstream/master is most common. If there are conflicts, repeat the following two lines as necessary:
After all conflicts have been resolved:
deleting remote branches
(The first line usually works; sometimes when it didn’t I’ve had luck with the second.)
untracking a file