Skip to content

Instantly share code, notes, and snippets.

@maphew
Last active November 19, 2019 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maphew/1b706e66e87919dbd2538f21b6ea9f26 to your computer and use it in GitHub Desktop.
Save maphew/1b706e66e87919dbd2538f21b6ea9f26 to your computer and use it in GitHub Desktop.
Git shallow clone: only branches with recent activity, as determined by Github
# 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