git:如何查看由于推送而导致的更改? [英] git: how to see changes due to push?

查看:139
本文介绍了git:如何查看由于推送而导致的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法完全弄清楚如何通过'push'来查看远程仓库中究竟发生了什么变化。 'git log'向我显示了一系列提交,但这些提交发生在我的本地存储库中,并在不同的时间被推送;我想知道哪些提交是每个特定推送的一部分。其实,您可以将这些信息从引用日志。这不是远程存储库的完整历史记录,而是远程存储库分支副本的历史记录。因此,您不会看到其他人对远程存储库所做的更改。这不是很好,但你可以编写一个脚本使其更容易。



例如:

  $ git reflog show origin / master 
ca4f119 refs / remotes / origin / master @ {0}:pull --rebase:fast-forward
d303ece refs / remotes / origin / master @ {1}:pull --rebase:fast-forward
ce28c26 refs / remotes / origin / master @ {2}:pull --rebase:fast-forward
0f71883 refs / remotes / origin / master @ {3}:pull --rebase:fast-forward
8c2f0dd refs / remotes / origin / master @ {4}:pull --rebase:fast forward
2958d6c refs / remotes / origin / master @ {5}:通过
更新6e9558c refs / remotes / origin / master @ {6}:pull --rebase:fast-forward
8854b35 refs / remotes / origin / master @ {7} :pull --rebase:fast-forward
b96f25d refs / remotes / origin / master @ {8}:pull --rebase:fast-forward
efb0ab8 refs / remotes / origin / master @ {9} :pull --rebase:fast-forward
71c12ca refs / remotes / origin / master @ {10}:pull --rebase:fast-forward
d860e59 refs / remotes / origin / master @ {11} :更新推
6342dbb refs / remotes / origin / master @ {12}:fetch:快进
...

你可以在这里看到我最近推出的高级 origin / master 来自 6e9558c 2958d6c 。要查看提交,可以使用 git log 6e9558c..2958d6c 。例如,

  $ git log --abbrev-commit --pretty = oneline 6e9558c..2958d6c 
2958d6c提交摘要4
5cbe548提交摘要3
13d007c提交摘要2
4f19ac3提交摘要1

如果您有远程存储库的终端访问权限,那么您可以在这方面做类似的事情,以查看收到的所有推送内容。


I can't quite figure out how to see what exactly was changed, in the remote repository, by a 'push'. 'git log' shows me the series of commits but those took place in my local repository and were pushed at different times; I would like to know which commits were part of each specific 'push'

解决方案

Actually, you can fish this information out of the reflog. It's not the full history of the remote repository but rather it's the history of your copy of the remote repository's branch. So, you will not see changes that were made to the remote repository by other people. It's not pretty, but you can probably write a script to make it easier.

For example:

$ git reflog show origin/master
ca4f119 refs/remotes/origin/master@{0}: pull --rebase: fast-forward
d303ece refs/remotes/origin/master@{1}: pull --rebase: fast-forward
ce28c26 refs/remotes/origin/master@{2}: pull --rebase: fast-forward
0f71883 refs/remotes/origin/master@{3}: pull --rebase: fast-forward
8c2f0dd refs/remotes/origin/master@{4}: pull --rebase: fast forward
2958d6c refs/remotes/origin/master@{5}: update by push
6e9558c refs/remotes/origin/master@{6}: pull --rebase: fast-forward
8854b35 refs/remotes/origin/master@{7}: pull --rebase: fast-forward
b96f25d refs/remotes/origin/master@{8}: pull --rebase: fast-forward
efb0ab8 refs/remotes/origin/master@{9}: pull --rebase: fast-forward
71c12ca refs/remotes/origin/master@{10}: pull --rebase: fast-forward
d860e59 refs/remotes/origin/master@{11}: update by push
6342dbb refs/remotes/origin/master@{12}: fetch: fast-forward
...

You can see here that my most recent push advanced origin/master from 6e9558c to 2958d6c. To see the commits you can use git log 6e9558c..2958d6c. E.g.,

$ git log --abbrev-commit --pretty=oneline 6e9558c..2958d6c
2958d6c Commit Summary 4
5cbe548 Commit Summary 3
13d007c Commit Summary 2
4f19ac3 Commit Summary 1

If you have terminal access to the remote repository, you could do something similar on that end to see all of the pushes that it received.

这篇关于git:如何查看由于推送而导致的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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