Alright, lets say one day we make happen to make a bunch of modifications and when we go to commit them we notice we were working on the wrong branch.
How can we force git to switch branches without discarding local changes.
I’m probably going to go about this in a naive way while I wait a reply, but I would like to know if theres a correct procedure as I’d be lying if I said this hasn’t happened to me before…
- Backup changed repo
git reset --hard
git checkout right-branch
- Restore changes
git commit -m "changes"