How to compare two different commits on the same branch in github?

前端 未结 5 1336
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 04:09

Comparing histories on the same branch is very confusing for me on GitHub. I struggle with this regularly:

If I use compare/master in the URL after the

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 04:35

    You can use the Github Compare UI, which will generate the URL for you. Replace ORG and REPO with your values. The UI only lists branches, but you can also type in any valid Tags (e.g. v1.0.0) or Commit IDs (e.g. 1a2b3c).

    https://github.com/ORG/REPO/compare/


    The URLs that get generated are in this format. You can also manually edit the URL with the REFs.

    https://github.com/ORG/REPO/compare/REF1...REF2

    You can also use "2 dots" (direct diff) instead of "3 dots" (diff from last common commit). Same as git diff A..B vs git diff A...B.

    https://github.com/ORG/REPO/compare/REF1..REF2

    If you want to compare across forks, then you need to add ORG2:

    https://github.com/ORG/REPO/compare/REF1...ORG2:REF2

    There is documentation, but I didn't think it was that clear: https://help.github.com/en/github/committing-changes-to-your-project/comparing-commits-across-time

提交回复
热议问题