I have made some changes in my master branch. I want to switch those changes to a new branch and restore master branch back to where it was before changes.
I used git switch -c <new-branch>
command.
It created a new branch with all the changes I had done in master which is good, but when switching back to master the changes are still present in the master branch.
I thought the behavior would be that it would reset master and move the changes to the new-branch.
I am afraid to discard changes in master as it may discard them in the new-branch?
Is there a different command that will allow me to achieve moving all changes to a new branch and discarding those changes in main?
I also tried git checkout -b <new-branch>
Thank you.
8