Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you recreate the GitHub pull request diff on the commandline?

While working on a branch that I've opened a pull request on, I would like to see the exact same diff that GitHub displays on the commandline. What is the particular git diff command that replicates the list of changes GitHub displays for a pull request?

like image 640
Jacob Dalton Avatar asked Sep 27 '14 21:09

Jacob Dalton


People also ask

How do I recreate a pull request?

Make a new PR If you don't want to bother GitHub support or they are too slow for you or are unwilling, you can do the following: recreate your fork. recreate your branch from the pull request by doing git fetch <your configured remote for upstream> refs/pull/<your PR number>/head:<your branchname>

How do I use the diff command in git?

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.


1 Answers

The closest thing is to diff with the common ancestor between your feature-branch and your base-branch.

Something like:

git diff `git merge-base feature-branch base-branch`
like image 62
pic Avatar answered Nov 01 '22 20:11

pic