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

Re: [Q] Abbreviated history graph?

From
SBSanti Béjar <santi@agolina.net>
Date
Nov 3, 2008, 14:20 UTC
Message-ID
<adf1fd3d0811030620x1bc53db3y2afb26242e9906ac@mail.gmail.com>
In-Reply-To
<200811031439.12111.brian.foster@innova-card.com>

On Mon, Nov 3, 2008 at 2:39 PM, Brian Foster <brian.foster@innova-card.com> wrote:

Show 28 quoted lines
>
> Hello,
>
>  A colleague and I recently wanted to examine the
>  history in a broad sense without worrying too much
>  about the individual commits.  What we (think we)
>  wanted is a 'gitk --all' history graph showing only
>  "named" historical points; i.e., tags and branch
>  HEADs, perhaps with an indication of whether or not
>  it's a "linear" change sequence that leads from one
>  to another.  That is, hypothetically, if the history
>  looks something like (where 'A' &tc has a name as
>  per above, and '*' does not):
>
>     A--->*--->*--->C--->D--->*----->E
>      \                   \         /
>       \->*-->B            \->*--->*--->F
>
>  What we wanted to see is something like:
>
>     A------>C--->D--->E
>      \       \       /
>       \->B    \-----/--->F
>
>  Is there some way of doing something similar to that
>  (git v1.6.0.2)?  In addition to 'gitk', we also (rather
>  quickly!) tried both 'qgit' and 'giggle', but without
>  any apparent success.

Not in git.git but you can use the script at the bottom (also attached in case it is whitespace damage). It could be much faster if "git log" stops when finding a tag/branch.

HTH, Santi

[git-overview] #!/bin/sh

TMP=$(mktemp -t git-overview.XXXXXXXXXXX) trap 'rm -f "$TMP"' 0 1 2 3 15

git log --reverse --pretty=short --decorate --pretty=format:%H%d $@ |\
    awk 'BEGIN {FS="[ ,()]*"} NF>=2 {print $1}' | \
    while read hash ; do
    # Independent tags/branches parents:
    # Notes:
    #   * -n 1000 to limit the search, ideally "git log" could stop
    #     traversing the history when hits a tag/branch tip
    #   * head -n 25 because "git show-branch --independent" has this limit
    ancestors=$(git log -n 1000 --pretty=short --decorate
--pretty=format:%H%d $hash^@ |\
    awk 'BEGIN {FS="[ ,()]*"} NF>=2 {print $1}' | head -n 25)
    if [ -n "$ancestors" ] ; then
	echo $hash $(git show-branch --independent $ancestors)
    else
	echo $hash
    fi
done > $TMP
GIT_GRAFT_FILE=$TMP gitk "$@" -d
Previous: Brian FosterNext: Santi Béjar
Message 2 of 18 in “[Q] Abbreviated history graph?”
  1. Brian FosterNov 3, 2008
  2. Santi BéjarNov 3, 2008
  3. Santi BéjarNov 3, 2008
  4. Brian FosterNov 3, 2008
  5. Santi BéjarNov 3, 2008
  6. Linus TorvaldsNov 3, 2008
  7. 1/4 Add a 'source' decorator for commitsLinus Torvalds, Nov 3, 2008
  8. 2/4 revision: make tree comparison functions take commits rather than treesLinus Torvalds, Nov 3, 2008
  9. 3/4 Make '--decorate' set an explicit 'show_decorations' flagLinus Torvalds, Nov 3, 2008
  10. 4/4 Add support for 'namespace' history simplificationLinus Torvalds, Nov 3, 2008
  11. Santi BéjarNov 3, 2008
  12. Linus TorvaldsNov 3, 2008
  13. Santi BéjarNov 3, 2008
  14. Robin RosenbergNov 3, 2008
  15. Clemens BuchacherNov 4, 2008
  16. Linus TorvaldsNov 3, 2008
  17. Linus TorvaldsNov 3, 2008
  18. Junio C HamanoNov 4, 2008

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.