git diff-仅显示遥控器上的新功能 [英] git diff - show only what's new on the remote

查看:74
本文介绍了git diff-仅显示遥控器上的新功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在github上有一个本地仓库和一个远程仓库.由于业务原因,它们不同步.我在本地保留了很多工作,现在我要手动将远程的新功能添加到本地.没有分支.

I have a local repo and a remote repo on github. For business reasons, they aren't in sync. I've done a lot of work on the local that I'm keeping, and now I'm manually adding whatever's new to the remote, to my local. There are no branches.

当我使用命令时,

git diff --color master..origin/master

我得到了很好的结果,显示了更改....我添加到本地存储库中的内容标有-符号,并显示为红色;而遥控器上的内容以绿色显示并带有+号.

I get good results, showing what changed.... what I have added to the local repo is marked with a - sign, and is shown in red; while what is on the remote is shown in green with + signs.

有没有一种方法可以显示仅远程上的新内容而不是本地上的新内容?也就是说,请向我显示遥控器上的任何新文件,并向我显示遥控器上文件中的任何新行或修改过的行(向我显示所有绿色的+)

Is there a way to show only what is new on the remote and not on the local? That is, show me any new files on the remote and show me any new or modified lines in files on the remote (show me all the green +'s)

谢谢.

推荐答案

我相信您可以在命令的两个分支之间放置3个点,然后相对于第一个分支,它只会在第二个分支中做新的事情,即

I believe you can put 3 dots between the two branches in the command and then it does only whats new in the second with respect to the first, i.e.

git diff master...feature

查看该功能的新功能,

git diff feature...master

看看master上有什么新内容.在您的情况下,功能可以为origin/master,并且应该可以正常工作.

to see what's new on master. In your case feature can be origin/master and that should work fine.

这篇关于git diff-仅显示遥控器上的新功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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