Skip to content

Instantly share code, notes, and snippets.

@werkshy
Created September 15, 2016 20:00
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 werkshy/4d3b986eab0a9fb1caa501ad626e15e4 to your computer and use it in GitHub Desktop.
Save werkshy/4d3b986eab0a9fb1caa501ad626e15e4 to your computer and use it in GitHub Desktop.
Git aliases for ~/.gitconfig
[alias]
s = status
st = status # svn muscle memory
stat = status # svn muscle memory
co = checkout # svn muscle memory
cp = cherry-pick # svn muscle memory
fp = push --force-with-lease # prevents force push if there's new commits on master
lol = log --pretty=oneline --abbrev-commit --graph --decorate # compact log format
recent-branches = !"git for-each-ref --sort=-committerdate refs/heads/ | head" # show recent branches
list-merged = !"git branch --merged | grep -v '\\*' | grep -v master | xargs -n 1" # list branches that are merged into master
delete-merged = !"git branch --merged | grep -v '\\*' | grep -v master | xargs -n 1 git branch -d" # delete branches that are merged into master
unpushed = log --branches --not --remotes=origin # show branches that have not been pushed to master
wip = !"git add -A; git commit -n -m 'wip'" # create a quick WIP commit of your current state
unwip = !git log -n 1 | grep -q -c wip && git reset HEAD~1 # reset the last commit if it is a WIP commit (go back to your pre-wip state)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment