Skip to content

Instantly share code, notes, and snippets.

@X0nic
Last active December 12, 2015 07:09
Show Gist options
  • Save X0nic/4734616 to your computer and use it in GitHub Desktop.
Save X0nic/4734616 to your computer and use it in GitHub Desktop.
Handy Git Commands
#remove old git remote branches
git remote prune origin --dry-run
git remote prune origin
#fancy git log
git log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
#alias, put in ~/.gitconfig
#[alias]
# lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
# Find out which branch a commit is in
git branch --contains <the commit>
# change rename limit
git config merge.renameLimit 999999
git config --unset merge.renameLimit
# revert single file
git checkout [commit-ref] -- [filename]
git checkout HEAD~5 [filename]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment