Skip to content

Instantly share code, notes, and snippets.

@raorao
Last active October 10, 2019 20:16
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 raorao/6a712a96f0cd392b42241439518fd352 to your computer and use it in GitHub Desktop.
Save raorao/6a712a96f0cd392b42241439518fd352 to your computer and use it in GitHub Desktop.
Applying large changes to co-owned repos

Prerequisties

  • a script that can make all necessary changes, with no manual intervention.

Steps for Implementer

  1. check out master, run the script, commit the result
git fetch origin
git checkout master
git checkout -b apply-script
"<script>"
git commit -m -"apply script"
git push origin apply-script
  1. get changes merged to master

  2. make a new branch ("base") and revert the commit in which you ran the script, and push it (this branch will never get merged)

git fetch origin
git checkout master
git checkout -b base
git revert :/'apply script'
git push origin base

Steps for other developers

  1. use filter-branch to apply changes to feature branch.
git checkout your-feature-branch
git fetch origin
git rebase origin/base
git filter-branch --tree-filter "<script>" origin/master..HEAD
git rebase origin/master
git push origin your-feature-branch --force-with-lease

Thanks @avh4 for the guidance on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment