Not sure if this is a proper way to work with branches.
Request:
How can this be done?
If you created a separate branch that got messed up, all you need to do is switch back to the one you were on before: git checkout A
(assuming A
is the name of the branch you were on... or maybe it's master
).
You can delete the bad branch later, if you want, with git branch -d <branchname>
and maybe throw in a -f
too, if there are unmerged commits.
Edit: If your repository contains lots of bad changes you want to remove, you can use git reset --hard HEAD
to undo them. If there are new files (not tracked by git), git clean -fd
will remove them all. Obviously, use with discretion as they will not be recoverable by git.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With