threads / discuss / 13677

visualizing Git's Git repo

Subject: visualizing Git's Git repo

## tl;dr

9 messages between May 26, 2008 and May 28, 2008.

replies: 8people: 7as markdown or json

Joshua Haberman· May 26, 2008, 20:47 UTC · lore

I'm a casual Git user. One thing that's been troubling me about Git is that when I look at Git's own Git repository, the revision history is not at all easy to understand. I like to view my own Git repositories with:

$ gitk --all --date-order

When I run this command, what I'm really asking is "give me a visual summary of what's up with my project lately." But with Git's repository, there are far too many branches and merges for this view to make any kind of visual sense.

So my questions are:
1. what do you all do to get a high-level view of what's going on with  
Git development?  do you use gitk?  if so, what options?
2. as a project, why don't you rebase when merging long-running  
branches into master?  For example, take commit 7e83003029 from May 25  
which merged a branch that was based at 4b172de81 from May 14.  Why  
not rebase this to May 25 as part of the merge?  When you don't do  
this (ie. in the status quo) 'gitk --date-order' for the Git  
repository has >10 parallel branches most of the time, which makes it  
impossible to follow visually.

I'm sure you have reasons for doing things the way you do, I just want to hear what they are. And sorry if this is a FAQ -- feel free to point me at any documentation that explains this.

Josh
Eric Hanchrow· May 26, 2008, 22:59 UTC · re: Joshua Haberman · lore

Re: visualizing Git's Git repo

You might not know -- I didn't until five minutes ago -- that you can omit entire branches, like this:

        $ gitk --all  ^refs/remotes/origin/man ^refs/remotes/origin/html
-- 
The story will be familiar to anyone who has ever seen a movie about a
troubled athlete and a brilliant coach.  It will also be familiar to
anyone who has not.  -- Roger Ebert, on "Stick It" (2006)
Joshua Haberman· May 26, 2008, 23:42 UTC · re: Eric Hanchrow · lore

Re: visualizing Git's Git repo

Eric Hanchrow <offby1 <at> blarg.net> writes:
Show 5 quoted lines
> 
> You might not know -- I didn't until five minutes ago -- that you can
> omit entire branches, like this:
> 
>         $ gitk --all  ^refs/remotes/origin/man ^refs/remotes/origin/html

Thanks for the tip -- I had tried the converse, which is to only include master, but both this and your strategy still leave at least 10 concurrent branches at almost any point in time.

Josh
Shawn O. Pearce· May 26, 2008, 23:46 UTC · re: Eric Hanchrow · lore

Re: visualizing Git's Git repo

Eric Hanchrow <offby1@blarg.net> wrote:
Show 5 quoted lines
> You might not know -- I didn't until five minutes ago -- that you can
> omit entire branches, like this:
> 
>         $ gitk --all  ^refs/remotes/origin/man ^refs/remotes/origin/html
> 
And if you do this a lot you can remember it as a shorthand:
	$ git config alias.seeall '! gitk --all  ^refs/remotes/origin/man ^refs/remotes/origin/html'
	$ git seeall
-- 
Shawn.
Björn Steinbrink· May 27, 2008, 00:41 UTC · re: Joshua Haberman · lore

Re: visualizing Git's Git repo

On 2008.05.26 13:47:33 -0700, Joshua Haberman wrote:
Show 15 quoted lines
> I'm a casual Git user.  One thing that's been troubling me about Git is 
> that when I look at Git's own Git repository, the revision history is not 
> at all easy to understand.  I like to view my own Git repositories with:
>
> $ gitk --all --date-order
>
> When I run this command, what I'm really asking is "give me a visual  
> summary of what's up with my project lately."  But with Git's  
> repository, there are far too many branches and merges for this view to 
> make any kind of visual sense.
>
> So my questions are:
>
> 1. what do you all do to get a high-level view of what's going on with  
> Git development?  do you use gitk?  if so, what options?

Doesn't make much sense with --all, but if you only view one branch, eg. origin/master or origin/next, --no-merges might produce an output that's more suitable for you.

Björn
Joshua Haberman· May 27, 2008, 20:36 UTC · re: Joshua Haberman · lore

Re: visualizing Git's Git repo

Joshua Haberman <joshua <at> reverberate.org> writes:
> 1. what do you all do to get a high-level view of what's going on with  
> Git development?  do you use gitk?  if so, what options?

I get the impression from this thread that core Git developers don't make visualizing the repository a regular part of their development workflow. Is that accurate? What do you all do to keep tabs on Git development?

> 2. as a project, why don't you rebase when merging long-running  
> branches into master?

Is there really no rationale that anyone can offer for why you do things this way? I look to Git's own Git repo for best practices, and given Git's emphasis on "history hygiene" I'm certain that there are reasons for why you do things the way you do.

Josh
Jeff King· May 27, 2008, 23:49 UTC · re: Joshua Haberman · lore

Re: visualizing Git's Git repo

On Tue, May 27, 2008 at 08:36:16PM +0000, Joshua Haberman wrote:
Show 6 quoted lines
> > 1. what do you all do to get a high-level view of what's going on with  
> > Git development?  do you use gitk?  if so, what options?
> 
> I get the impression from this thread that core Git developers don't make
> visualizing the repository a regular part of their development workflow.  Is
> that accurate?  What do you all do to keep tabs on Git development?

I don't know if I count as a core Git developer, but I do use gitk daily to track what goes into Junio's repo. My refs are organized something like:

  remotes/origin/* - tracking branches of Junio's git.git
  heads/jk/* - long running topics branched from master
  heads/next - Junio's next branch with short or temporary patches on top
My git day generally starts like this:
  git fetch ;# grab newly merged stuff
  gitk origin/next...next ;# see what's new
  git rebase origin/next ;# and bring ourselves up to date

You don't necessarily get to see all of the topic branches labeled individually, but generally you see each merged topic preceded by the 'Merge ...' commit.

For long running branches, I leave them alone until I'm ready to work on them. And then it's:

  git checkout jk/whatever
  gitk origin/master.. ;# what was I doing again?
  git rebase origin/master ;# should be clean if nobody else
                            # is touching the same area
And if the rebase isn't clean, then I investigate individual areas with:
  gitk --no-merges jk/whatever...origin/master problematic_file.c

So maybe that is a bit of a boring workflow description, but I do visualize with gitk all the time. I tend to do a lot of bug-hunting, too, for which I don't end up doing visualization. Instead, I almost always rely on asking more specific questions about content: blame (especially "tig blame"), bisect, and pickaxe ("git log -S").

-Peff
Linus Torvalds· May 28, 2008, 03:15 UTC · re: Joshua Haberman · lore

Re: visualizing Git's Git repo

On Mon, 26 May 2008, Joshua Haberman wrote:
Show 6 quoted lines
>
> I'm a casual Git user.  One thing that's been troubling me about Git is that
> when I look at Git's own Git repository, the revision history is not at all
> easy to understand.  I like to view my own Git repositories with:
> 
> $ gitk --all --date-order

I would seriously suggest avoiding "--date-order" unless you have some deep reason to see how the commits on different development paths relate to each other date-wise - something you should normally not have.

The thing is, --date-order strings out and mixes up the commits on the same development chain, and by doing so it makes the different chains of development much harder to see. It also ends up showing the development in a more "parallel" way, which in turn makes the view even harder to read.

So I would suggest not using --date-order by default. It doesn't add anything to any normal flow, and it makes the big picture harder to see.

The only time you really want --date-order (or "-d", which is shorthand for it for just gitk) is really

 - when the big picture is really really simple, and you actually want to 
   see more detail because the big picture is too trivial to even be 
   interesting otherwise.
   (In other words: --date-order is fine for really simple development 
   where there is only ever just a couple of branches or where you have 
   pruned away so much of the history that the remaining part is simple)
 - when you want to debug "git rev-list" behaviour itself, since the date 
   order actually matters for how git traverses the commit chains.

The second case is something that I suspect nobody but me and a few other people have ever done. I found it very useful together with --show-all when I was debugging the revision walker (see commits

	3131b713013f06285cad3ffdcc61f417ac4ba158
	7d004199d134c9d465e013064f72dbc04507f6c0

where the first implements --show-all, and the second one is the end result of my debugging).

In other words: never start out with "-d" or "--date-order" by default. Only if you have some reason to then think that the view is too simple or you need to drill down into the commit relationships should you use it.

> 1. what do you all do to get a high-level view of what's going on with Git
> development?  do you use gitk?  if so, what options?

I use "gitk" almost every time when I pull from anybody in the kernel. I tend to do it with git itself, when I update from Junio. The most common arguments I use is

	gitk ORIG_HEAD..
or
	gitk @{12.hours.ago}..

where the latter in particular is very nice to see an overview of "ok, what did I pull today".

And I basically *never* use --date-order, nor do I often look at more than one single branch.

The one special case is when merging, and there are conflicts. In that case, I often look at two branches, and I often do

	gitk MERGE_HEAD... <filenames>

to see the symmetric difference (actually, I usually just do "gitk --merge" which is just shorthand for the above). And in that case, I do occasionally add a "-d", because that shows what the relative timing were for the commits, which is sometimes interesting information (ie if there are clashes, which commit is the more recently committed one can actually be somewhat relevant - although it's rare).

So in that case I look at two branches (the one I'm on, and the one I'm merging), and the "..." format means that I ignore everything that is common to them.

> 2. as a project, why don't you rebase when merging long-running branches into
> master?

For the kernel, there's been a lot of discussion about why I prefer people to rebase vs merge (or often - *avoiding* merges entirely), see the kernel mailing list, and search for merging. There was a thread (subject: "[alsa-devel] HG -> GIT migration") about a week ago where I tried to explain my opinions about about some of this.

		Linus
Jakub Narebski· May 28, 2008, 08:39 UTC · re: Linus Torvalds · lore

Re: visualizing Git's Git repo

Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 10 quoted lines
> On Mon, 26 May 2008, Joshua Haberman wrote:
> >
> > 2. as a project, why don't you rebase when merging long-running branches into
> > master?
> 
> For the kernel, there's been a lot of discussion about why I prefer people 
> to rebase vs merge (or often - *avoiding* merges entirely), see the kernel 
> mailing list, and search for merging. There was a thread (subject: 
> "[alsa-devel] HG -> GIT migration") about a week ago where I tried to 
> explain my opinions about about some of this.
You can read summary of this (I think) discussion at KernelTrap:
  http://kerneltrap.org/Linux/Git_Management
-- 
Jakub Narebski
Poland
ShadeHawk on #git

← back to recent threads