Created
February 6, 2025 15:52
-
-
Save CJHwong/876b63f7dc4aa21de924bc28a0268306 to your computer and use it in GitHub Desktop.
Git: Find Old Remote Branches
This file contains hidden or 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
git fetch --all --prune && git for-each-ref --format=$'%(committerdate:unix)\t%(refname:lstrip=2)\t%(committername)' refs/remotes/ | awk -F'\t' -v cutoff=$(date -v-3m +%s) ' | |
$1 < cutoff { | |
committer = $3; | |
branches[committer] = branches[committer] "\n - " $2; | |
} | |
END { | |
for (c in branches) { | |
print c ":" branches[c]; | |
print "=========================="; | |
} | |
}' > old_remote_branches_report.txt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment