Last active
April 2, 2020 08:51
-
-
Save edugon/8dee2e7b32d5a8fcda8a1d16b59f3993 to your computer and use it in GitHub Desktop.
Aliases to show or delete local branches that are not tracking remote anymore.
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
# The commands will match "TD" pattern as branch name and "gone]" to check if branches are untracking. | |
# Note: Depending on language you have in your git client, "gone]" part may change to e.g. "desaparecido]". | |
# WARNING: In case the branch has "gone]" in some commit, prune command will also delete it. | |
# Same happens for unmerged branches, change it to "git branch -d" for a safer usage. | |
alias git_show_untracking="git branch -vv | awk '\$3~/TD/ && \$4~/gone]/ {print \$1}'" | |
alias git_prune_untracking="git branch -vv | awk '\$3~/TD/ && \$4~/gone]/ {print \$1}' | xargs -n1 git branch -D" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment