Revert changes to a file in a commit

后端 未结 8 1947
無奈伤痛
無奈伤痛 2020-12-12 09:45

I want to revert changes made by a particular commit to a given file only.

Can I use git revert command for that?

Any other simple way to do it?

8条回答
  •  心在旅途
    2020-12-12 10:20

    If you'd like to reset the changes on a file from your last commit, this is what I'm usually using. I think this is the simplest solution.

    Please notice that the file will be added to the staging area.

    git checkout  -- 
    

    Hope it helps :)

提交回复
热议问题