Last active
November 19, 2019 17:43
-
-
Save maphew/1b706e66e87919dbd2538f21b6ea9f26 to your computer and use it in GitHub Desktop.
Git shallow clone: only branches with recent activity, as determined by Github
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
# from https://stackoverflow.com/questions/58702233/git-shallow-clone-only-branches-with-activity-last-x-months | |
export URL=https://github.com/leo-editor/leo-editor/branches/active | |
curl $URL > x.html | |
printf '\n-- Commands to add the remote branches to the fetch list:\n' | |
grep 'data-branch-name' x.html | sed -r 's/^.*data-branch-name="(.*?)"(.*$)/git remote set-branches --add origin \1/' | |
printf '\n-- Modification dates for these branches:\n' | |
grep 'time-ago' x.html | sed -r 's/^.*datetime="(....-..-..).*$/\1/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment