git diff file against its last change

前端 未结 3 1636
误落风尘
误落风尘 2021-01-29 17:42

Is it possible to get git to produce a diff between a specific file as it exists now, and as it existed before the last commit that changed it?

That is, if we know:

3条回答
  •  心在旅途
    2021-01-29 18:10

    If you are fine using a graphical tool this works very well:

    gitk 
    

    gitk now shows all commits where the file has been updated. Marking a commit will show you the diff against the previous commit in the list. This also works for directories, but then you also get to select the file to diff for the selected commit. Super useful!

提交回复
热议问题