git pushup
- Pushes a branch and sets the upstream to be the branch of the same name (useful if your git push.default
is simple
):
On Linux:
git config --global alias.pushup \!'git push --set-upstream origin `git symbolic-ref --short HEAD`'
On Windows:
git config --global alias.pushup '!git push --set-upstream origin `git symbolic-ref --short HEAD`'
git trim
- Prunes branches which are merged or have been deleted on the remote (never deletes develop or master):
git config --global alias.trim \!'git fetch --prune && git branch --merged | grep -E -v "^((\* )|\s*(develop|master)$)" | xargs git branch -d'
git pullup
- Pulls a branch only if it can be fast forwarded, branch doesn't have to be checked out
git config --global alias.pullup \!'f() { BRANCH=$(git symbolic-ref --short HEAD); if [ $# -eq 0 ] || [[ $BRANCH == $1 ]]; then git pull --ff-only; else git fetch origin $1:$1; fi; }; f'