Skip to content

Instantly share code, notes, and snippets.

@CreaturePhil
Last active August 29, 2015 14:09
Show Gist options
  • Save CreaturePhil/c72b9dbd56aebe718364 to your computer and use it in GitHub Desktop.
Save CreaturePhil/c72b9dbd56aebe718364 to your computer and use it in GitHub Desktop.
Git notes

Git setup

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

Check your settings

$ git config --list

Git diff

The git diff command is used when you want to see differences between any two trees. This could be the difference between your working environment and your staging area ( git diff by itself), between your staging area and your last commit ( git diff --staged ), or between two commits ( git diff master branchB ).

Git rm cache

You may want to keep the file on your hard drive but not have Git track it anymore. This is particularly useful if you forgot to add something to your .gitignore file and accidentally staged it, like a large log file or a bunch of .a compiled files. To do this, use the --cached option:

$ git rm --cached README

Git Aliases

$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
$ git config --global alias.unstage "reset HEAD --"
$ git config --global alias.last "log -1 HEAD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment