Skip to content

Instantly share code, notes, and snippets.

@jnewland
Created December 11, 2009 02:08
Show Gist options
  • Save jnewland/253925 to your computer and use it in GitHub Desktop.
Save jnewland/253925 to your computer and use it in GitHub Desktop.
# git cheat sheet. Pretty much all you need. Corrections to @troyd, credit to @lindvall
# settings
git config --global branch.autosetupmerge true
git config --global push.default current
# create new branch locally
git checkout -b prove-brooks-law-42
# then on remote server
# (requires http://git-wt-commit.rubyforge.org/git-publish-branch in path)
git publish-branch
# check out existing remote branch
git checkout -b prove-brooks-law-42 origin/prove-brooks-law-42
# something in vendor/ is out of date; update it
git submodule init
git submodule update
# accidentally commit (not push) in master instead of existing branch?
# check everything in, then:
git checkout -b the-branch-you-meant
git checkout master
git reset --hard origin/master
# merged and finished with a branch? delete it. remote:
git publish-branch -d prove-brooks-law-42
# or local:
git branch -d prove-brooks-law-42
# forcibly delete a branch you wish never existed
git branch -D prove-brooks-law-42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment