How can I reset or revert a file to a specific revision?

前端 未结 30 2007
不思量自难忘°
不思量自难忘° 2020-11-21 11:23

I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous versio

30条回答
  •  梦毁少年i
    2020-11-21 11:37

    If you know how many commits you need to go back, you can use:

    git checkout master~5 image.png
    

    This assumes that you're on the master branch, and the version you want is 5 commits back.

提交回复
热议问题