How do I view previous diff commits using Git?

我的未来我决定 提交于 2020-01-30 14:15:06

问题


How do I view previous diff commits using Git?

I have a file that I've made several commits on, but I want to view previous versions of the file AND its diff's at different stages. Seeing where I made mistakes and how I fixed them is really helping my code. By the way, I'm using Tower as a GUI on top of Git.


回答1:


git log --full-diff -p your_file_path

Check out:
http://git-scm.com/docs/git-log




回答2:


You need git log. If you were interested in file SOMEFILE use

$ git log -p SOMEFILE

The -p option displays the patch which is probably the diff you are looking for.




回答3:


If you don't want to specify a particular file, and see the diff for all files changed, just use

$ git log -p


来源:https://stackoverflow.com/questions/5901300/how-do-i-view-previous-diff-commits-using-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!