如何查看git fetch之后将要合并的内容 [英] How to see what will be merged after git fetch
问题描述
我的问题是在执行git fetch
之后,如何查看从源头实际获取的git是什么?
我通过使用diff来猜测,但我不知道该怎么做.
My question is after doing a git fetch
how can I see what is what git actually fetched from origin?
I have my guesses by using diff but I don't know exactly how I can do it.
推荐答案
由于在git fetch
之后获取的引用位于origin/master
中(仅作为示例,如果您有更多分支,则它们将更新为以及origin/<name>
,您也可以应用以下命令),这里有几个选项:
Due to the fact that after a git fetch
the fetched references are in origin/master
(just an example, if you have more branches then they are updated as well as origin/<name>
and you can apply the following commands as well) you have several options here:
1.仅显示已更改的文件名
git diff --name-only origin/master
2.仅显示文件状态
git diff --name-status origin/master
3.真正显示发生了什么变化
git diff origin/master
或者您将git show
用于此任务:
git show --oneline --name-only master..origin/master
Or you use git show
for this task:
git show --oneline --name-only master..origin/master
为了完整起见,您可以使用以下命令来计算获取到的提交.
And for completeness you can use the following command to count commits that where fetched.
git rev-list --count HEAD..origin/master
这篇关于如何查看git fetch之后将要合并的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!