I'm using git inside Visual Studio 2013. I'm trying to revert to a specific commit without losing the history leading from that commit to the current commit. In other words, I want git to generate a new commit that has the same snapshot as the specified commit. This is what I've done:
git revert <commit>
where <commit>
is the id of the commit I intend reverting to.
Executing the above (in Visual Studio's git command prompt) resulted in the following error:
Found a swap file by the name ".git\.COMMIT_EDITMSG.swp" while opening file ".git\.COMMIT_EDITMSG.swp" NEWER than swap file!
and that
Swap file ".git\.COMMIT_EDITMSG.swp" already exists!
I can't figure out what it means. Did I do it wrong? How am I supposed to revert to a specific commit?
The swap file is created by the editor vim when you start editing a file; it essentially is a backup file in case the editor crashes.
Now, if the editor launches and finds a swap file, it will usually prompt you to decide what to do, whether to restore the previous editor session or to discard those changes.
If you don’t care about that, you can just delete the swap file first before launching the editor:
rm .git/.COMMIT_EDITMSG.swp
This should remove the swap file, so the next time the editor launches, you no longer get that message and can just work as usual.
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