Skip to content

Instantly share code, notes, and snippets.

@leipert
Last active September 20, 2016 11:55
Show Gist options
  • Save leipert/a0a5dabb634130cb0588eca2d5777820 to your computer and use it in GitHub Desktop.
Save leipert/a0a5dabb634130cb0588eca2d5777820 to your computer and use it in GitHub Desktop.
Useful git aliases
[alias]
## pulling
# git p: pulls all branches, autostashing and rebasing instead of merging
# this is a similiar behaviour to git-up
p = pull --rebase --autostash --all --verbose --no-recurse-submodules
# git smiu: update all submodules recursively (and init them if necessary)
smiu = submodule update --init --recursive
# git up: update current project
up = "!git p && git smiu"
## repository maintenance
# git purge: remove local branches that have been merged into develop
purge = "!git merged > /dev/null && git merged | xargs -n 1 git branch -d || echo No merged branches found locally"
# git purge-remote: remove remote branches that have been merged into develop
purge-remote = "!git merged-remote > /dev/null && git merged-remote | cut -d\"/\" -f 2- | xargs -n 1 git push origin --delete || echo No merged branches found on remote"
## investigating
# git merged: list all local branches that have been merged into develop
merged = "!git branch --merged develop | grep -Ev \"(\\*|master|develop)\""
# git merged-remote: list all remote branches that have been merged into develop
merged-remote = "!git branch -r --merged develop | grep -Ev \"(\\*|master|develop)\""
[tag]
sort = version:refname
[versionsort]
prereleaseSuffix = -pre
prereleaseSuffix = -rc
prereleaseSuffix = -RC1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment