Elijah Lynn
Elijah Lynn

Reputation: 13468

Way to compare range of commits in pull request on Github?

Scenario, first 5 commits in a PR have already been code reviewed. Made a few more commits and want to focus in on those.

How can I compare a range of commits in the pull request on Github?

Upvotes: 48

Views: 22833

Answers (5)

neomaniacs
neomaniacs

Reputation: 1

Here are the steps:

  • Open the commits dropdown
  • Click on shift and keep it clicked
  • Select all the commits u wanna review
  • Wait some seconds, it is loading ( keep you shift button down )

... et voilà.

Upvotes: 0

wisbucky
wisbucky

Reputation: 37827

Github has added a way to manually select any range of commits in a pull request. See the screenshot:

range of commits feature

If you need to scroll down to choose more than the viewable commits - it won't work. You can change the css hight of the element

enter image description here

Upvotes: 49

Jay E
Jay E

Reputation: 101

GitHub has a built-in way to do this. In the Files changed tab, click the "Changes from all commits" dropdown at the top left. Then press and hold down the shift key, click your start commit, and then (while still holding down shift) click the end commit.

Upvotes: 10

alexey_detr
alexey_detr

Reputation: 1700

The most convenient way I found is:

  1. Open PR conversation
  2. Find the last commit that have already been reviewed and click its hash link, your URL will look like https://github.com/airbnb/javascript/pull/188/commits/2b6c524e6984f300f6c6e08e57c8dbab9497e798
  3. Change commits to files and add ..HEAD to the end of URL such as https://github.com/airbnb/javascript/pull/188/files/2b6c524e6984f300f6c6e08e57c8dbab9497e798..HEAD

You'll see commits range you want to review in context of the PR.

P.S. Now GitHub provides functionality to view "Changes since your previous code review" but sometimes it is useful to select changes manually

Upvotes: 73

Elijah Lynn
Elijah Lynn

Reputation: 13468

Github support responded with:

You can use the compare view for that:

https://github.com/rails/rails/compare

You can construct the compare URL manually as well, e.g.

https://github.com/rails/rails/compare/c51aa9f6f2c361e1efc53020028592564318e8a6...35a816a86a74e35b00e1e6d6e55aff01dd40980d

Upvotes: 18

Related Questions