How to get the changes on a branch in Git
In the context of a revision list, A...B
is how git-rev-parse
defines it. git-log takes a revision list. git-diff
does not take a list of revisions - it takes one or two revisions, and has defined the A...B
syntax to mean how it's defined in the git-diff
manpage. If git-diff
did not explicitly define A...B
, then that syntax would be invalid. Note that the git-rev-parse
manpage describes A...B
in the "Specifying Ranges" section, and everything in that section is only valid in situations where a revision range is valid (i.e. when a revision list is desired).
To get a log containing just x, y, and z, try git log HEAD..branch
(two dots, not three). This is identical to git log branch --not HEAD
, and means all commits on branch that aren't on HEAD.
git cherry branch [newbranch]
does exactly what you are asking, when you are in the master
branch.
I am also very fond of:
git diff --name-status branch [newbranch]
Which isn't exactly what you're asking, but is still very useful in the same context.
What you want to see is the list of outgoing commits. You can do this using
git log master..branchName
or
git log master..branchName --oneline
Where I assume that "branchName" was created as a tracking branch of "master".
Similarly, to see the incoming changes you can use:
git log branchName..master