gitgit-alias

Error in getting commit history between two tags - Use '--' to separate paths from revisions


How to get rid of below error to get the commit history? sometimes it works not all the time

git log '--pretty=format:%ad - %s [%an]' v1.0.11...b1.0.12
fatal: ambiguous argument 'v1.0.11...b1.0.12': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Any help would be appreciated!


Solution

  • EDIT: After discussion in comments one of the tags wasn't local, git fetch --tags resolves this.

    Are you sure you don't mean v1.0.11..b1.0.12 with two dots (..) rather than three (...).

    Also is b1.0.12 a typo when you meant v1.0.12. I suspect this because error reports unknown revision.

    The meaning of .. and ... can be found in git help rev-parse. Here's a snippet;

    The .. (two-dot) Range Notation

    The ^r1 r2 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.

    The …​ (three-dot) Symmetric Difference Notation

    A similar notation r1...r2 is called symmetric difference of r1 and r2 and is defined as r1 r2 --not $(git merge-base --all r1 r2). It is the set of commits that are reachable from either one of r1 (left side) or r2 (right side) but not from both.