Stranger
Stranger

Reputation: 10610

Find new commit ids on a git tag

During each release, I'm checking out to the previous tag, cherry-picking new commit IDs into it and creating a new tag and making a release. For example, if my previous release name is Tag.1.15.50.31. Here is what I'll do,

git checkout Tag.1.15.50.31
git cherry-pick new-commit-id-1
git cherry-pick new-commit-id-2
.
.
.
.
so on.

And then to create tag, I'll use

git tag -a Tag.1.15.50.32 -m 'drop 1.15.50.32'

After Tag.1.15.50.32 I did some 4 releases and currently I'm on the tag number Tag.1.15.50.36. Now, how to find newly cherry-picked commit-ids in 32 (i.e., new-commit-id-1 and new-commit-id-2)?

Upvotes: 1

Views: 62

Answers (1)

torek
torek

Reputation: 487755

So, you mean you have a commit graph that goes something like this:

                 - o - o      <-- various
o - o - o - ... - o - o - o   <-- branches
     \            - o - o     <-- not especially interesting
      \
       o   <-- Tag.1.15.50.30
        \
         o - o - o   <-- Tag.1.15.50.31 (3 cherry picked commits)
                  \
                   * - *   <-- Tag.1.15.50.32 (2 cherry picked commits)

and you want to find all commits reachable from Tag.1.15.50.32, excluding all commits reachable from Tag.1.15.50.31, which would then be just the two commits marked * here?

The command git rev-list lists revisions that meet some criteria, and gitrevisions has syntax to generate revision-sets including precisely the kind you're looking for. Namely, B selects revisions reachable from B, and ^A excludes revisions reachable from A, so B ^A produces such a list; and the special short-hand syntax A..B means B ^A.

Thus:

git rev-list Tag.1.15.50.31..Tag.1.15.50.32

should list just the revisions that were created by the git cherry-pick actions.

Upvotes: 1

Related Questions