Last active
December 23, 2015 07:29
-
-
Save trdarr/6600850 to your computer and use it in GitHub Desktop.
A manual cross-repository rebase
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
# If you haven't already, clone the new repo and `cd` into its directory. | |
git clone [email protected]:username/new-repo.git | |
cd new-repo | |
# Add the old repo as a remote and fetch from it. | |
# If you're trying to do this from an unpushed branch, | |
# git remote add old-repo ~/dev/old-repo.git | |
git remote add old-repo [email protected]:username/old-repo.git | |
git fetch old-repo | |
# Create local branches that track the old-repo's develop and feature. | |
git checkout -b old-develop --track old-repo/develop | |
git checkout -b feature --track old-repo/feature | |
# Rebase from old-develop..feature onto develop. | |
# That is, starting at develop, recommit the commits that comprise feature. | |
git rebase -s subtree --onto develop old-develop feature | |
# Push the newly-rebased feature to origin. | |
git push --set-upstream origin feature |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment