Skip to content

Instantly share code, notes, and snippets.

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 ambethia/138187 to your computer and use it in GitHub Desktop.
Save ambethia/138187 to your computer and use it in GitHub Desktop.
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