Skip to content

Instantly share code, notes, and snippets.

@pohly
Created April 28, 2026 15:29
Show Gist options
  • Select an option

  • Save pohly/c4ada0d9d617917f5dbfffaf7053fae2 to your computer and use it in GitHub Desktop.

Select an option

Save pohly/c4ada0d9d617917f5dbfffaf7053fae2 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
prune () {
find . -name "*_test.go" -delete
go mod tidy
}
# Set up initial commit on branch, using v1.7.0 as root.
git checkout v1.7.0
prune
git commit -m "create master-lite by removing tests from v1.7.0" .
git branch -f master-lite
git tag -f v1.7.0-lite
for ver in v1.7.1 v1.8.0 v1.8.1 v1.9.0; do
git checkout $ver
prune
# This commit will be discard, we just want the resulting tree.
git commit -m unused .
tree=$(git show --no-patch --format=%T HEAD)
# This is the actual commit.
commit=$(git commit-tree $tree -p $(git rev-parse master-lite) -p $(git rev-parse $ver) -m $ver)
git branch -f master-lite $commit
git tag -f $ver-lite $commit
done
git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment