Created
June 19, 2012 16:09
-
-
Save joernhees/2955006 to your computer and use it in GitHub Desktop.
github howto reconfigure git repository if cloned original and forked later
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
# so let's say you cloned repo someone/project like this | |
git clone git://github.com/someone/project.git | |
# you use it and then later on discover a bug. | |
# to fix it you create a fork on github to which you can | |
# write and issue a pull request, but now your origin is | |
# someone/project instead of you/project . | |
# fix it like this: | |
git remote rename origin upstream | |
git add origin git://github.com/you/project.git | |
git fetch origin | |
git push -u origin master | |
####### after this: ######## | |
git fetch # fetches origin, so your fork | |
git checkout master | |
git pull # in your master branch: fetches your origin/master | |
# and merges it into your master | |
git push # pushes to your fork | |
git checkout master | |
git fetch upstream # fetches the original someone/project | |
git merge upstream/master # in your master branch: merge | |
# someone/project into your master | |
git push # pushes to your fork |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment