我怎样才能看到git中的传入提交? [英] How can I see incoming commits in git?

查看:555
本文介绍了我怎样才能看到git中的传入提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:


如何在git中看到传入的提交?或甚至更好,看看我只是 git fetch / git pull ed?



编辑:为了澄清问题:有人告诉我,为了获得一些修复,我应该从他们的存储库中取出。我的目标是在我接受他们之前了解他们的变化。 git pull 自动合并,这不是我想要的。 git fetch 会在没有合并的情况下抓取它们,但是我不确定如何查看我刚刚插入的内容。原始语句的原因是我通常使用Mercurial,其中该命令将会是 hg incoming< / code>—> git似乎缺少一个模拟命令。

解决方案

在git中不是一个直接的映射,因为你可以(而且我经常这样做)如果有相当于hg的传入命令,它可能是这样的:

$ b $



b

  git fetch&& git log ..origin / master 

也就是说,抓住所有来自上游的东西,然后比较我的当前分支与上游主分支。



同样,外向就是这样:

  git fetch&& git log origin / master .. 

实际上,我只是手动输入这些(即使我创建了别名之一),因为很多本地分支机构很容易跟踪并被许多远程分支机构跟踪,并且无需将它们放在一起。


Possible Duplicate:
Using Git how do I find modified files between local and remote

How can I see incoming commits in git? Or even better, see what I just git fetch/git pulled?

Edit: To clarify the question: someone tells me that, to get some fixes, I should pull from their repository. My goal is to see what their changes are before I accept them. git pull automatically merges, which is not what I want. git fetch will grab them without merging, but I'm unsure how to view what exactly I just pulled in. The reason for the original phrasing is that I normally use Mercurial, where the command would be hg incoming <repo name here>—a command for which git seems to lack an analog.

解决方案

incoming isn't quite a direct mapping in git because you can (and I often do) have multiple repos you're pulling from, and each repo has multiple branches.

If there were an equivalent of hg's incoming command, it'd probably be this:

git fetch && git log ..origin/master

That is, "go grab all of the stuff from the upstream, and then compare my current branch against the upstream master branch."

Similarly, outgoing would be this:

git fetch && git log origin/master..

In practice, I just type those manually (even though I created an alias for one of them) because it's easy to have lots of local branches tracking and being tracked by lots of remote branches and have no trouble keeping it together.

这篇关于我怎样才能看到git中的传入提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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