git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Specifying revisions in the future

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 5, 2012, 02:44 UTC
Message-ID
<m3ipjmknhc.fsf@localhost.localdomain>
In-Reply-To
<jgjkk0$qrg$1@dough.gmane.org>
jpaugh@gmx.us writes:
> Hello.
Show 8 quoted lines
> I want to do a certain arbitrary operation for each revision between
> where I am now and the tip of the branch.
> 
>           v1.0-a     master
>             \          \
> o---o---o---o---o---o---o
>             |
>            I am here
That is the problem X.
 
> Is it possible to specify revisions in the future? The gitrevisions man
> page implies otherwise. Alternatively, is there a way to find out the
> number of commits between two revs---assuming one is an ancestor of the
> other?
That is your idea of a solution, Y.

You have XY problem. You need to do X, and you think you can use Y to do X, so you ask about how to do Y.

If you want to list all revsions between v1.0-a and master, use
  git rev-list v1.0a..master
or
  git rev-list --ancestry-path v1.0a..master

depending on definition of _between_ (see "History simplification" in git-log(1) manpage for description of `--ancestry-path` option).

Show 21 quoted lines
> 
> I've been using the following to do what I want:
> 
> ref=master; \
> for i in {5..1}; do \
>   echo; \
>   git log --stat $ref~$i^\!; \
>   read -p 'Full diff? '; \
>   echo; \
>   if [[ $REPLY == 'y' ]]; then \
>     git diff $ref~$i^\!; \
>   fi; \
> done;
> 
> which lists the log and diffstat for last 5 commits between master and
> where I am (e.g. an older tag/branch) with an optional full diff. I know
> implementing revision specifiers to the future is nontrivial. (I
> realized that when I considered non-linear histories.) In this case,
> I've distilled it to the point that all I need is the number of commits
> between two revs. Can this be had without manually inspecting git log?
> Or, is there a better way to get detailed diffs like this?
-- 
Jakub Narebski
Previous: jpaugh@gmx.usNext: Matthieu Moy
Message 2 of 16 in “Specifying revisions in the future”
  1. jpaugh@gmx.usFeb 4, 2012
  2. Jakub NarebskiFeb 5, 2012
  3. Matthieu MoyFeb 5, 2012
  4. Andreas SchwabFeb 5, 2012
  5. Jakub NarebskiFeb 5, 2012
  6. Andreas SchwabFeb 5, 2012
  7. Jakub NarebskiFeb 5, 2012
  8. Philip OakleyFeb 5, 2012
  9. Andreas SchwabFeb 5, 2012
  10. Miles BaderFeb 6, 2012
  11. Jonathan PaughFeb 7, 2012
  12. Matthieu MoyFeb 6, 2012
  13. Andreas SchwabFeb 6, 2012
  14. Andreas SchwabFeb 5, 2012
  15. Junio C HamanoFeb 5, 2012
  16. Jakub NarebskiFeb 5, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.