Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git diff showing only commits that revision/branch A is ahead of revision/branch B

Tags:

git

Sometimes I have the following problem:

  1. Add some commits in a feature branch.

  2. Update master from upstream.

  3. Want to see the diff between the feature branch and master, but git diff master shows all of the things that have been added/removed in master, when I really only want to see the commits that the feature branch is ahead of master, not the ones that it's behind.

Is there a way to do this without having to merge master into the feature branch?

like image 711
mwhite Avatar asked Jul 11 '13 23:07

mwhite


People also ask

How do I see commit between two branches?

In order to see the commit differences between two branches, use the “git log” command and specify the branches that you want to compare. Note that this command won't show you the actual file differences between the two branches but only the commits.

Does git diff show all changes?

The git diff command returns a list of all the changes in all the files between our last commit and our current repository. If you want to retrieve the changes made to a specific file in a repository, you can specify that file as a third parameter.

Which command shows the changes between commits?

"git diff" always show the difference between two commits (or commit and working directory, etc.).

How do I view changes from a previous commit?

Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.


1 Answers

I think the right answer is triple dot

git diff master...feature 

That shows only new changes on feature with respect to master. See also: git diff - show only what's new on the remote

like image 70
Danny Roberts Avatar answered Sep 22 '22 14:09

Danny Roberts