git - 提交之前电流变化的差异 [英] git - diff of current changes before committing
问题描述
我可以通过调用<$ c $获得更改列表c> git status 。但是,除了文件名之外,我如何获得已更改的行或内容的列表?
我最初考虑过使用 git diff ,但它似乎很有用仅用于比较已经提交的更改。
通常我只是做 meld。
,但在这种情况下,我已连接通过ssh到外部服务器。
如果您已对临时区域添加( staged )更改, git commit
构成的数据。
P上。 S. Git初学者的好阅读(IMO): b
$ b
I have changed several files in a git repository, but have not committed them yet.
I can get a list of the changes by just invoking git status
. But how do I get a listing of the lines or the content that I have changed, in addition to the filenames?
I initially thought about using git diff, but it seems to be useful only for comparing already commited changes.
Usually I just do meld .
, but on this case I'm connected to an external server via ssh.
git diff
by default shows difference between your working directory and the index (staging area for the next commit).
If you have already added (staged) the changes to the staging area, git diff --staged
does the job. Staging area is the data from which the next commit will be formed by git commit
.
P. S. Good reading (IMO) for Git beginners:
- https://git-scm.com/book/en/v2 (most chapters; it explains the model behind Git and answers most of typical questions)
- and then immediately http://gitready.com/ (usage tips).
这篇关于git - 提交之前电流变化的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!