How to find and restore a deleted file in a Git repository

前端 未结 27 1087
挽巷
挽巷 2020-11-22 01:25

Say I\'m in a Git repository. I delete a file and commit that change. I continue working and make some more commits. Then, I find I need to restore that file.

I know

27条回答
  •  醉话见心
    2020-11-22 02:05

    Actually, this question is directly about Git, but somebody like me works with GUI tools like the WebStorm VCS other than knowing about Git CLI commands.

    I right click on the path that contains the deleted file, and then go to Git and then click on Show History.

    The VCS tools show all revisions train and I can see all commits and changes of each of them.

    Then I select the commits that my friend delete the PostAd.js file. now see below:

    And now, I can see my desire deleted file. I just double-click on the filename and it recovers.

    I know my answer is not Git commands, but it is fast, reliable and easy for beginner and professional developers. WebStorm VCS tools are awesome and perfect for working with Git and it doesn't need any other plugin or tools.

提交回复
热议问题