git - 提交之前电流变化的差异 [英] git - diff of current changes before committing

查看:112
本文介绍了git - 提交之前电流变化的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可以通过调用<$ c $获得更改列表c> git status 。但是,除了文件名之外,我如何获得已更改的内容的列表?



我最初考虑过使用 git diff ,但它似乎很有用仅用于比较已经提交的更改。



通常我只是做 meld。,但在这种情况下,我已连接通过ssh到外部服务器。

解决方案

git diff 您的工作目录和下一个提交的索引临时区域)之间的差异。



如果您已对临时区域添加( staged )更改, git diff --staged 做这项工作。 Staging区域是下一个提交将由 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:

这篇关于git - 提交之前电流变化的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆