add git-gone alias

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-04-13 14:31:56 -04:00 committed by Alice Huston
parent 13481e49d2
commit 1fab349ff4

View File

@ -14,11 +14,15 @@
}; };
userEmail = "aliceghuston@gmail.com"; userEmail = "aliceghuston@gmail.com";
userName = "ahuston-0"; userName = "ahuston-0";
includes.config.contents = { aliases = {
alias = { gone = ''
gone = !git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | # dump all branches
!"git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" {print $1}' | xargs -r git branch -D"; awk '$2 == "[gone]" {print $1}' | # get nuked branches
sed 's/\\x27/\\x5C\\x27/' | # remove single quotes, for xargs reasons
xargs -r git branch -D # nuke the branches
'';
}; };
extraConfig = {
push.autosetupremote = true; push.autosetupremote = true;
pull.rebase = true; pull.rebase = true;
color.ui = true; color.ui = true;