Skip to content
Peter Wu edited this page Sep 5, 2017 · 6 revisions

Reproducible rebase method

  1. Extract src/crypto/tls into repository.
  2. Rebase any branches on top of that.

See this gist for an automated script. In essence:

git fetch https://go.googlesource.com/go refs/tags/go1.9
git checkout -b upstream-go1.9 FETCH_HEAD
git filter-branch --prune-empty --index-filter \
    'git ls-files -s | sed "s-\('"$(printf '\t')"'src/\)pkg/-\1-" |
        GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
        mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD -- \
        src/pkg/crypto/tls/ src/crypto/tls/
git filter-branch -f --prune-empty --subdirectory-filter src/crypto/tls HEAD

Original rebase method

(Not recommended as rebasing changes is not deterministic wrt committer information.)

git remote add go https://go.googlesource.com/go
git fetch go
git branch go-tip go/master
git filter-branch -f --subdirectory-filter src/crypto/tls -- go-tip
git rebase -i # use commits from go-tip
git branch -f go-vendor go/master
git filter-branch -f --subdirectory-filter src/vendor/golang_org/x/crypto/ -- go-vendor
git filter-branch --tree-filter 'mkdir -p vendor/golang_org/x/crypto && git ls-tree --name-only $GIT_COMMIT | xargs -I files mv files vendor/golang_org/x/crypto'  -- go-vendor
Clone this wiki locally