In the fugitive summary buffer, the powerful X command does as explained in :help fugitive_X:

Discard the change under the cursor. This uses checkout or clean under the hood. A command is echoed that shows how to undo the change. Consult :messages to see it again. You can use this during a merge conflict do discard "our" changes (--theirs) in the "Unstaged" section or discard "their" changes (--ours) in the "Staged" section.

I used X mistakenly then closed Vim because I was in a hurry. I had 5 changed files in the repository and I'm a bit sad to have lost those changes. It's a note taking repository with the effort of a few days (I know I should have committed earlier, it's not my main work, just notes on the side). A help hint in the message bar says to use the following to recover one file. I tested and managed to recover it.

:Gsplit art/music.md|Gread 124cdf331a4

Can I recover the other files checked out before that test? I didn't see the message back then and :message only prints message for the active vim session. How do I find out about fugitive messages printed in previous sessions? What are those hash numbers?


1 Answer 1


You have almost certainly lost the :messages. I am not aware of any builtin messages persistence.

However, if fugitive or git managed to save the blobs, you could try to find them with git fsck (check --unreachable or --dangling) or else just poking around in the list of blobs (https://stackoverflow.com/q/1595631/4400820). Test each with git cat-file -p <sha>; if it is correct, you can git cat-file blob <sha> >/path/to/the/file or similar to restore the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.