如何区分本地未提交的更改和原点 [英] How to Diff between local uncommitted changes and origin
问题描述
git diff master master / master
来区别原始存储库在本地提交之前,是否有任何方法可以在服务器上使用原始存储库区分本地更改?我尝试了 git diff - 缓存的master origin / master
的各种排列,没有运气。
鉴于远程仓库已通过 git fetch
进行了缓存,应该可以对这些提交进行比较。请尝试以下操作:
$ git fetch origin
$ git diff origin / master
Let's say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows git diff test.txt
and it will show me the difference between the current local HEAD and the modified, uncommitted changes in the file. If I commit those changes I can diff it against the original repository by using git diff master origin/master
But is there any way of diff'ing the local changes with the original repository on the server before committing locally? I tried various permutations of git diff --cached master origin/master
with no luck.
Given that the remote repository has been cached via git fetch
it should be possible to compare against these commits. Try the following:
$ git fetch origin
$ git diff origin/master
这篇关于如何区分本地未提交的更改和原点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!