Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The following command provides a visualization which is good enough to start from:

    git log --oneline --graph
The more practical problem is that Github, which provides a useful graphic UI to complement the local command line for any project hosted there, is brain dead[1] about showing the source control tree as a tree and doesn't expose anything like `--graph`.

If you get tired of typing `git log --oneline --graph`, you can add a `git slog` alias[2] for it by adding the following in `~/.gitconfig`:

    [alias]
        slog = log --oneline --graph
[1] Gitlab is superior in this aspect, as it actually exposes a graph mode, via "[repo] > Code > Repository Graph".

[2] Or if you want to get fancy: https://github.com/rectang/dotfiles/blob/064b22c42846f8a3f18...



`git log --graph` is just a really really bad GUI. Why not use a good GUI instead?

Although in fairness it's quite hard to find a good Git GUI because there are so many bad ones. The only good ones I've found all have some kind of flaw:

* GitX - the clearest design IMO, but it's one of those "gazillion forks" bits of software like TomatoUSB, and Mac only. Plus it has some annoying bugs.

* Git Extensions - I didn't even realise this was a Git GUI until relatively recently because it its terrible name. It's pretty decent, but Windows only.

* VSCode 'Git Graph' extension - my current favourite - it integrates into VSCode too which is much better than a standalone app, especially when using Remote SSH. However it is abandonware and although the source is available, the license doesn't let you republish it so it's not "open source" and nobody can take it over.

Disappointingly even these don't let you do things that a GUI obviously should let you do, like copy & pasting commits, dragging and dropping to rebase.

Like instead of `git rebase -i` and tedious text edits, why can't I just ctrl-select some commits, ctrl-C and ctrl-V?

But, they're still miles better than `git log --graph`.


Compare the graphs that people draw to explain git branching. They are usually very beautiful. Then you see the graph even these GUIs make, and they are still pretty bad. I think the visual graphs could be improved quite a lot.


`git log --graph` without `--oneline` is pretty hard to follow — that's not what I use, and it's not what I suggested.

With `--oneline`, it's not perfect but it's good enough to be useful — and by working within the constraints of the CLI, I didn't have to tell people to install software to get my point across.

And I already spoke approvingly of Gitlab's GUI for graph representation! I don't disapprove of GUIs; I use them all the time (particularly Github's). One you grok the data structures that underlie Git, you wind up seeing front ends as interchangeable.


I meant any variation of `git log --graph`.


Well, then I simply don’t agree that `git log --oneline --graph` is “really, really bad”.

Clunky? Sure, but it suffices to visualize simple branching patters. And no visualizer suffices for gnarly graphs (like a long-lived topic branch that has repeatedly merged in upstream), because the building a mental model of a complex history is difficult even if you can see it.


I use Git Extensions since 2012 or something?

I basically never used Git command line unless fixing some problems other people created.

It is just insanity when people claim "only proper way is to use command line" - well yeah it is much faster if you work on your branch and just need to make quick series of commits. But as soon as you have to deal with collaboration with other people and organize project, coordinate features etc. I find GUI invaluable and Git Extensions of course.


> Like instead of `git rebase -i` and tedious text edits, why can't I just ctrl-select some commits, ctrl-C and ctrl-V?

git obeys $EDITOR, so you can get that like this with whatever text editor you want:

  EDITOR=gedit git rebase -i foo


No, I mean why can't you select commits in the graph and copy/paste them. I wasn't talking about copy/pasting the lines of text in the `git rebase -i` file.


Because the graph is a query and not a model with methods on it. If you realy want to, you can code it (and deal with conflicts)


It may serve a different purpose, but I personally use https://zolk3ri.name/cgit/ggrp/about/ for displaying commits, because it categorizes commits based on prefixes such as "feat:", "fix:" and so forth, and supports scopes too (e.g. "feat(foo)"), and a lot of my projects have commits with such prefixes.


> Like instead of `git rebase -i` and tedious text edits, why can't I just ctrl-select some commits, ctrl-C and ctrl-V?

You can do this with lazygit.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: