码迷,mamicode.com
首页 > 其他好文 > 详细

git 查看当前与上一次version的差异

时间:2016-12-01 17:11:19      阅读:362      评论:0      收藏:0      [点我收藏+]

标签:icon   pre   target   16px   simple   cer   font   mod   nbsp   

http://stackoverflow.com/questions/9903541/finding-diff-between-current-and-last-versions

 

 

As pointed out on a comment by amalloy, if by "current and last versions" you mean the last commit and the commit before that, you could simply use

git show
shareedit
 
3  
This is what I was looking for. Great answer. – CodeManiak Jan 19 at 22:50
3  
Simpler. This should be the accepted answer. – jbmusso Mar 2 at 9:21
6  
Use git show HEAD~1 to show the last-but-one commit, and git show HEAD~2, etc. for older commits. Show just a single file via git show HEAD~2 my_file. – Florian Brucker Mar 3 at 10:43

Assuming "current version" is the working directory (uncommitted modifications) and "last version" is HEAD (last committed modifications for the current branch), simply do

git diff HEAD

credit for following goes to user Cerran

And if you always skip the staging area with -a when you commit, then you can simply use git diff.

Summary

  1. git diff shows unstaged changes.
  2. git diff --cached shows staged changes.
  3. git diff HEAD shows all changes (both staged and unstaged).

Source: git-diff(1) Manual Page – Cerran

shareedit
 
14  
And if you always skip the staging area with -a when you commit, then you can simply use git diff. <1> git diff shows unstaged changes. <2> git diff --cached shows staged changes. <3> git diff HEAD shows all changes (both staged and unstaged). Source: git-diff(1) Manual Page – Cerran Feb 20 ‘14 at 13:16 
    
This is a good summary. Could be an answer. – user3527975 May 4 at 18:11

git 查看当前与上一次version的差异

标签:icon   pre   target   16px   simple   cer   font   mod   nbsp   

原文地址:http://www.cnblogs.com/oxspirt/p/6122644.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!