Created
May 12, 2017 22:31
-
-
Save JeffCarpenter/61c4f20c53a61137738aaffe47a46130 to your computer and use it in GitHub Desktop.
List branches whose head was committed prior to a given date
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
#!/bin/bash | |
function git-old-heads { | |
git show-ref --heads | grep -E "$(git rev-list --all --before="$1" | cut -d' ' -f2 | xargs | sed -e 's/ /|/g')" | |
} | |
function filter-branch-names { | |
cut -f2 -d' ' | sed -e 's|refs/heads/||g' | |
} | |
git-old-heads "$1" | filter-branch-names | |
# eg. git-old-branchs "2 months ago" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment