Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 418
Elijah Lynn Avatar asked Apr 08 '15 15:04

Elijah Lynn


People also ask

How do you compare two GitHub commits?

You can also compare two arbitrary commits in your repository or its forks on GitHub in a two-dot diff comparison. To quickly compare two commits or Git Object IDs (OIDs) directly with each other in a two-dot diff comparison on GitHub, edit the URL of your repository's "Comparing changes" page.

How do I compare pull requests on GitHub?

Submitting pull request on GitHubNavigate to the original GitHub repository, and you should see a big green button marked "Compare and pull request". Click that button and you will be taken to a page giving you the opportunity to describe your pull request and showing you the changes you have made.

How do you compare different commits?

You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.

How do I compare the differences between two branches in GitHub?

On the Github, go to the Source view of your project. You will see a link named 'Branch List'. Once the page opens you can see a list of all the remote branches. Hit on the Compare button in front of any of the available branches to see the difference between two branches.


1 Answers

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

like image 168
alexey_detr Avatar answered Sep 21 '22 01:09

alexey_detr