Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git diff show the same result as github's pull request diff?

After branches are merged, and GitHub no longer show difference when I try to make a pull request, but git diff will still show differences.

For example:

  1. I have branch D
  2. Created hotfix on branch H
  3. Merged H to D
  4. Created more stuff on D

Now GitHub pull request from H to D shows no difference but git diff H D show differences.

What I am trying to do is to create a command-line tool to see which old branches (there can be a lot) don't have code differences to develop. right now I have to go to GitHub, do a pull request and select each branch to see if there are difference.

like image 702
Gary Avatar asked Jun 11 '16 12:06

Gary


People also ask

Why git diff does not show changes?

Your file is already staged to be committed. You can show it's diff using the --cached option of git. To unstage it, just do what git status suggests in it's output ;) You can check The Git Index For more info.

Is git pull and pull request same?

If you use git pull , you pull the changes from the remote repository into yours. If you send a pull request to another repository, you ask their maintainers to pull your changes into theirs (you more or less ask them to use a git pull from your repository).

How do you make changes in the same pull request?

The current way to update a pull request is to click on the “Edit” button along the other pull request action buttons. This will bring you to the update pull request page where you can make changes to the title, description, reviewers and specify whether to close the branch after the pull request has been merged.

Can you give differences between pull request and branch?

A branch is just a separate version of the code. A pull request is when someone take the repo, makes their own branch, does some changes, then tries to merge that branch in (put their changes in the other person's code repository). (In the most general of terms.)


1 Answers

You probably want the "triple-dot" syntax:

git diff D...H 

See also What are the differences between double-dot ".." and triple-dot "..." in Git diff commit ranges?

like image 129
Oliver Charlesworth Avatar answered Oct 04 '22 21:10

Oliver Charlesworth