Skip to content

Instantly share code, notes, and snippets.

@ichux
Created May 21, 2024 06:03
Show Gist options
  • Save ichux/abbbef28836eb93de5988cd885f0e069 to your computer and use it in GitHub Desktop.
Save ichux/abbbef28836eb93de5988cd885f0e069 to your computer and use it in GitHub Desktop.

Full Step-by-Step Example

Let's assume the temporary branch is backup.

  1. Change the default branch to backup on GitHub:

    • Go to "Settings" -> "Branches" -> change the default branch to backup.
  2. Delete the remote main branch:

    git push origin --delete main
  3. Push your local main branch to the remote:

    git push origin main
  4. Change the default branch back to main:

    • Go to "Settings" -> "Branches" -> change the default branch back to main.
  5. Delete the backup branch if it was temporary:

    git push origin --delete backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment