Unexpected underscore in git log –graph output

When running git log --graph on my copy of the Linux kernel, I’m seeing an underscore in the graph that doesn’t look like it should be there.

What does that underscore mean?

  • git push NOT current branch to remote
  • Git start branch from another branch without tracking
  • how to find crlf line separators with git?
  • How can I get the total lines committed today in git?
  • switching branches in git - when will i get “You have local changes cannot switch branches.”?
  • Git commits are duplicated in the same branch after doing a rebase
  • The specific command I’m using is thus:

    git log --graph --decorate --pretty=oneline --abbrev-commit --all --date-order
    

    And the output looks like this:

    git log --graph output

    I’ve tried looking at this area in the graph in gitk, but there doesn’t seem to be anything out of the ordinary there.

    I don’t think this is just showing a branch point, as I’d expect that to be rendered as on the right, not as on the left (the left should match the image above):

    I see:        I'd expect for
                  normal branching:
    
     \ \ \         \ \ \
     / / /         / / /
    | _ /         | / /
    |  /          |/ /
    | |           | |
    | |           | |
    

  • How to make Git “add --all” by default?
  • Looking for a way automate the “bump version” with git flow
  • Sub-directory into independent repository and later merge back into main repository
  • Why git decide that my file is binary
  • How to migrate from RTC Jazz to Git?
  • Git refusing to merge unrelated histories
  • 2 Solutions collect form web for “Unexpected underscore in git log –graph output”

    To me, this seems to be a rendering artefact. Most likely, the console output has some logic to prevent something like this

    / /
    | /
    

    from happening, as this snippet would not exactly show at which place a branch operation occurred. Thus, the designers probably opted for

    / /
    | _
    

    instead.

    But I could be wrong here, it seems to be something that should be checked out in the code.

    From ack "'_'" on the Git sources it looks like the underscore is printed in graph.c, line 1120, inside the graph_output_collapsing_line function:

    /*
     * Output out a line based on the new mapping info
     */
    for (i = 0; i < graph->mapping_size; i++) {
        int target = graph->new_mapping[i];
        if (target < 0)
            strbuf_addch(sb, ' ');
        else if (target * 2 == i)
            strbuf_write_column(sb, &graph->new_columns[target], '|');
        else if (target == horizontal_edge_target &&
             i != horizontal_edge - 1) {
                /*
                 * Set the mappings for all but the
                 * first segment to -1 so that they
                 * won't continue into the next line.
                 */
                if (i != (target * 2)+3)
                    graph->new_mapping[i] = -1;
                used_horizontal = 1;
            strbuf_write_column(sb, &graph->new_columns[target], '_');
        } else {
            if (used_horizontal && i < horizontal_edge)
                graph->new_mapping[i] = -1;
            strbuf_write_column(sb, &graph->new_columns[target], '/');
    
        }
    }
    

    But after thinking about it for a while it doesn’t make much sense anyway. The underscore is a symbol for crossing an unrelated branch to the left from the current one, to get to a branch point somewhere further to the left. This can be seen on other places in your screenshot, but this particular underscore really looks lost.

    Git Baby is a git and github fan, let's start git clone.