Undo changes to the main branch

49 Views Asked by At

I made changes to the main branch like pushing the changes to another branch and just resetting the main branch to default

try:git reset --hard origin/main but it resets all the ramifications, does anyone know how to solve this?

1

There are 1 best solutions below

0
Raf4Killer On

If you have the same problem as mine, this was the step by step guide to solve it:

1 - git branch -m new-branch-name (rename the branch where the change was made)

2 - git checkout main (go back to the main branch)

Then you will have the default main branch and the changed branch.