How to know the different of change in git

时间:2015-11-12 11:05:06

标签: git

I have file A.text with value 'a' and I did modify and change it to 'b'

with which command in git I can find the value before the change

also lets assume that I stage the file and now I change it again to 'b2'

How I can find the value 'a' ?

I need it only in the stage part of index part meaning I did change without stage I want to find the old value , now I stage and I did change for the file without commit

2 个答案:

答案 0 :(得分:3)

If Unstaged

git diff <filename>

This should show you all the additions/deletions to that file in the unstaged hunk of the file. Your old value i.e "a" should come in the deletions in file and new value "b" should come under additions to file.

For the staged hunk

git diff --cached <filename>

This will show you all the additions/deletions in the staged hunk.

That is all there is to this.

答案 1 :(得分:0)

git diff between the commit with the "a" value, and your latest change ?

Documentation : http://alx.github.io/gitbook/3_comparer_les_commits_-_git_diff.html

相关问题