I'm trying to revert to a specific commit ( 3d5575f8e4c97ddab8ad5d540fee4664c04db75d ), but when i do:
git revert 3d5575f8e4c97ddab8ad5d540fee4664c04db75d
it says:
fatal: 'revert' is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>' as
appropriate to mark resolution and make a commit, or use 'git commit -a'.
I don't care those changes, and I also want to lose those changes, revert to that commit (soft revert, dont want to lose the files) THEN repull down changes. My local stuff is all messed up. Any help?
I think you want to use git reset 3d5575f8e4c97ddab8ad5d540fee4664c04db75d
. This will keep your working files as is, but reset your HEAD to the commit you specified. Additionally, it should reset your index as well (clears out files you have selected to commit, add, remove, etc).
If you want to get rid of all the changes to your working files, use git reset --hard 3d5575f8e4c97ddab8ad5d540fee4664c04db75d
.
You want to do:
git reset 3d5575f8e4c97ddab8ad5d540fee4664c04db75d
This will "reset" you to the commit specify.
git revert just creates a new commit which reverts the changes of that commit, which is probably not what you want.
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