Created
June 5, 2012 13:36
-
-
Save mattgibson/2875045 to your computer and use it in GitHub Desktop.
Copying a distinct feature or hotfix branch from one release branch to another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example scenario: two Moodles - one 2.1.x, one 2.2.x. Fix is on 2.2.x and we want to backport it | |
# to 2.1.x. Each moodle is a separate repo roughly following the gitflow approach and there is a | |
# separate develop and release branch for each one. | |
# Push to gihub from the repo that has the fix branch | |
# Fetch from github from the repo that needs it (assuming we have one repo for each release branch) | |
# Checkout the fix branch as a new local branch | |
git checkout -b localfix origin/fixbranch | |
# Find the SHA1 of the commit where fix diverged from master or develop (the last non-fix commit) | |
# Rebase the localfix onto the target branch | |
git rebase --onto targetbranch <SHA1> localfix | |
# Merge it nicely | |
git checkout targetbranch | |
git merge --no-ff localfix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment