Skip to content

Instantly share code, notes, and snippets.

@joernhees
Created June 19, 2012 16:09
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 joernhees/2955006 to your computer and use it in GitHub Desktop.
Save joernhees/2955006 to your computer and use it in GitHub Desktop.
github howto reconfigure git repository if cloned original and forked later
# 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