Skip to content

Instantly share code, notes, and snippets.

@lucianomlima
Last active February 29, 2020 14:24
Show Gist options
  • Save lucianomlima/a72cfe59ad8a38789cd2c4430d9dbdc2 to your computer and use it in GitHub Desktop.
Save lucianomlima/a72cfe59ad8a38789cd2c4430d9dbdc2 to your computer and use it in GitHub Desktop.
Usefull git alias
# Delete branch
# Usage: git delete branch-name
git config --global alias.delete 'branch -D'
# Update branch with prune refs
# Usage: git update master
git config --global alias.update '!git fetch origin -p && git merge $(git rev-parse --abbrev-ref @{u})'
# Last commit details
# Usage: git last
git config --global alias.last 'log -1 HEAD'
# Squash last X commits
# Usage: git squash 6
git config --global alias.squash '!git fetch && git reset --mixed HEAD^@{u} && git merge --squash HEAD@{1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment