I am using Doom Emacs 2.0.9 on Emacs 27.2.

I use magit to manage a local git repository.

In an earlier commit, there was a file. In the latest commit as well as the current working tree, the file no longer exists as it was deleted somewhere along the way.

I want to have that file from the earlier commit in the current working tree. How do I do that using magit?


2 Answers 2


You can use magit-file-checkout on the commit hash of your interest, or find the command (most likely f file) in Reset menu.

After selecting the commit hash, choose the file you wanna resurrect.


First you have to find the revision where the file was deleted. You can do that with magit-log, then advice the full file name in "Limit to files". You will get the commit where the file was removed at the top of the log buffer.

You can open file as it was just before deleted with magit-find-file, settings revision to rev^ where rev is the commit that delete the file. Or checkout it (magit-file-checkout) at the revision rev^.

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.