Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replacing forked repo's master branch with my own
git clone git@github.com:user_a/repo.git
cd repo
git branch -m master old-master
git symbolic-ref HEAD refs/heads/new-master
rm .git/index
git clean -fdx
# add a remote for user_b's repo, call it, say, user_b
git pull user_b master:new-master
git branch -m new-master master
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment