Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

git - 在暂存区域中显示文件中的git diff [复制](Show git diff on file in staging area [duplicate])

Possible Duplicate:

(可能重复:)
How do I show the changes which have been staged?

(如何显示已上演的更改?)

Is there a way I can see the changes that were made to a file after I have done git add file ?

(有没有办法可以看到我完成git add file后对file所做的更改?)

That is, when I do:

(也就是说,当我这样做时:)

git add file
git diff file

no diff is shown.

(没有显示差异。)

I guess there's a way to see the differences since the last commit but I don't know what that is.

(我想有一种方法可以看到自上次提交以来的差异,但我不知道那是什么。)

  ask by arod translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can show changes that have been staged with the --cached flag:

(您可以显示已使用--cached标志暂存的更改:)

$ git diff --cached

In more recent versions of git, you can also use the --staged flag ( --staged is a synonym for --cached ):

(在更新版本的git中,您还可以使用--staged标志( --staged--cached的同义词):)

$ git diff --staged

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...