Skip to content

Instantly share code, notes, and snippets.

@notch8
Created December 19, 2011 22:13
Show Gist options
  • Save notch8/1499151 to your computer and use it in GitHub Desktop.
Save notch8/1499151 to your computer and use it in GitHub Desktop.
branch = "acme"
# Make a patch file for each branch
.git checkout #{branch}
.git checkout master
.git diff --binary master #{branch} > #{branch}.patch
# Make a new branch
.git branch -D #{branch}
.git checkout -b #{branch}
# Apply the patch
.git apply #{branch}.patch
.git add app*
.git add lib*
.git commit -am "Re-applying all changes to previous branch so we can rebase on master in the future"
.git push --force origin #{branch}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment