Skip to content

Instantly share code, notes, and snippets.

@johntrimble
Last active January 3, 2016 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johntrimble/8404656 to your computer and use it in GitHub Desktop.
Save johntrimble/8404656 to your computer and use it in GitHub Desktop.
These are useful Git commands I keep forgetting.

Listing branches by most recent commit:

git for-each-ref --sort=-committerdate refs/heads/

Listing branches not yet merged:

git branch --no-merged <BRANCH_NAME>

Remove a file from version control without deleting it:

git rm --cached <SOME_FILE>

Removing a file from history:

git filter-branch --tree-filter 'rm -rf <SOME_FILE>' HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment