Skip to content

Instantly share code, notes, and snippets.

@volkovasystems
Created December 19, 2020 12:57
Show Gist options
  • Save volkovasystems/e45eed803f7d8060caf10d9a9c1530c8 to your computer and use it in GitHub Desktop.
Save volkovasystems/e45eed803f7d8060caf10d9a9c1530c8 to your computer and use it in GitHub Desktop.
git move branch to orphaned branch
If the orphaned branch is master and you want to move the main branch
(note that all branches must have corresponding remote branches to work properly)
git checkout master
then
git branch -M master main
then
git checkout master
then
git checkout main
then
git config remote.origin.push HEAD
then
git push --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment