Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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