Skip to content

Instantly share code, notes, and snippets.

@aryanprince
Created May 12, 2023 02:14
Show Gist options
  • Save aryanprince/5ebe35db00626dfee312c044bd065834 to your computer and use it in GitHub Desktop.
Save aryanprince/5ebe35db00626dfee312c044bd065834 to your computer and use it in GitHub Desktop.
How to replace 'main' branch with 'better_branch'

Make sure everything is pushed up to your remote repository (GitHub):

git checkout main

Overwrite "main" with "better_branch":

git reset --hard better_branch

Force the push to your remote repository:

git push -f origin main

Source: https://stackoverflow.com/a/31036317/20372336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment