300D7309EF17
300D7309EF17

Reputation: 24603

get changes newer than a given revision with git show

Using a simple example with commits A, B, C, D that are all in order (no weird tree structure), and given that I have SHAs for A and D, I am using git show like this:

git show --no-patch --abbrev-commit --abbrev=7 --format=short A D

That gives me the commits A, B, C, and D. But I want to get revisions newer than A (exclusive of A). I don't know the SHAs for B and C, and I'm hoping I can modify my revision specification without needing to make a second call to git.

Is it possible? I reviewed gitrevisions and couldn't find anything that applies. A^ and A~1 go in the wrong direction.

My use case is to find changes that will be deployed, so I have the git SHA of the last deployment.

Upvotes: 3

Views: 45

Answers (1)

Zombo
Zombo

Reputation: 1

git show A..D
This set operation appears so often that there is a shorthand for it.
When you have two commits r1 and r2 (named according to the syntax
explained in SPECIFYING REVISIONS above), you can ask for commits that
are reachable from r2 excluding those that are reachable from r1 by ^r1
r2 and it can be written as r1..r2.

Upvotes: 1

Related Questions