Skip to content

Instantly share code, notes, and snippets.

@zhangyoufu
Created June 14, 2018 05:46
Show Gist options
  • Select an option

  • Save zhangyoufu/ed93fd60c88efb91f6c4624a407f2bc5 to your computer and use it in GitHub Desktop.

Select an option

Save zhangyoufu/ed93fd60c88efb91f6c4624a407f2bc5 to your computer and use it in GitHub Desktop.
shallow clone commits from branch point to tip of master/release branch, with tags
#!/bin/sh
git clone --shallow-exclude=release-branch.go1.10 https://github.com/golang/go.git
cd go
git remote set-branches --add origin release-branch.go1.10
git fetch --shallow-exclude=master origin release-branch.go1.10
git checkout release-branch.go1.10
git fetch origin $(git ls-remote --tags origin | awk '{print "git show "$1" &>/dev/null && echo +"$2":"$2}' | sh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment