Last active
February 20, 2019 17:23
-
-
Save stavarengo/6674fc9f49eb2fce31724b8d8a2dd33b to your computer and use it in GitHub Desktop.
Git alias to remove from your local repostitory all branches and tags that does not exists on remote. Call it with `git pa`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[credential] | |
# Never as for you password again. | |
# When 'store' your password will be store in the file '$HOME/.git-credentials' in plain text (no encriptation), | |
# because of this, you must use a personal access token, generated here: https://github.com/settings/tokens | |
helper = store | |
[gui] | |
encoding = utf-8 | |
[core] | |
# Use Sublime as default editor. | |
editor = subl -n -w | |
autocrlf = input | |
[alias] | |
# Log aliases | |
l = !git l1 -35 | |
l1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)%ad(%ar)%C(red) %an%C(reset)%C(bold yellow)%d%C(reset) — %C(white)%s%C(reset) %C(bold white)' --abbrev-commit --date=iso | |
l2 = log --graph --pretty=format:'%C(bold blue)%h%C(white) - %C(bold green)%cr %C(white)- %C(bold red)%an%C(bold yellow)%d%C(white) - %s' --abbrev-commit --date=relative | |
l3 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit | |
l4 = log --graph --oneline | |
# Handfull shortcuts | |
ck = checkout | |
m = checkout master | |
d = checkout develop | |
# Prune aliases | |
# Prune Tags - Prune local Git tags that doesn't exist on remote 'origin' | |
p-tags=!git fetch --prune origin '+refs/tags/*:refs/tags/*' | |
# Prune Branches remote branchs and remove the local ones that as gonne on the remote | |
# See https://stackoverflow.com/a/33548037/2397394 | |
p-branch="!gitPruneBranch() { git fetch --prune && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done }; gitPruneBranch" | |
# Alinas for prune all branches and tags | |
p-all=!git p-branch && git p-tags | |
# A shortcut for the the command 'p-all' | |
pa=!git p-all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment