- Amend last commit, without editing commit message:
amend = !git add -A && git commit --amend --no-edit
- Sync and rebase with remote:
f = !git fetch --all && git rebase origin/master
- Compact status:
st = !git status -sb
- Pretty git logs (single line):
ls = !git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
- Remove merged branches (needs
grep
andxargs
):
rmb = !git branch --merged | grep -v '*' | xargs -n 1 git branch -d
- Push annotated tags simultaneously to master:
gpt = !git push origin master --follow-tags
At the end, some general purpose ones:
alias gac="git add . && git commit -m"
alias gi="git init"
alias gb="git branch"
alias gc="git checkout"
alias gcb="git checkout -b"
alias gra="git remote add"
alias gpm="git push origin master"
alias gsu="git stash -u -k"
alias undo="reset --soft HEAD^"