git: how to see changes due to push?

后端 未结 2 1578
心在旅途
心在旅途 2021-02-07 07:29

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 lo

2条回答
  •  暖寄归人
    2021-02-07 08:01

    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.

提交回复
热议问题