Skip to content

Instantly share code, notes, and snippets.

@baywet
Created March 20, 2018 20:27
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 baywet/0373d9a298bbb5f4cbd0ae6df6326872 to your computer and use it in GitHub Desktop.
Save baywet/0373d9a298bbb5f4cbd0ae6df6326872 to your computer and use it in GitHub Desktop.
two samples to solve situations where repositories have been imported instead of forked
git remote add downstream UrlOfImportedRepo
#foreach branch you want to bring back
git fetch downstream/branchname
git checkout branchname
git merge downstream/branchname #hopefully your history is not a mess and you don’t have conflicts to handle
git push origin
#end of foreach
git remote remove downstream
git remote remove origin
git remote add origin "new url of the repo"
git fetch origin
#for each branch you have locally (the ones in white when running git branch -a)
git checkout branchname
git branch --set-upstream-to origin/branchname
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment