TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Julien Cretel created the elegant gitdags package for easily generating educational git graphs, which I'm currently using to create educational and reference materials for my team.

When discussing branching in some context, I like to add a “kink” to the graph to visually reinforce the idea that a branch represents a line of development and that other work might continue concurrently

Git graph with branch “kink”

Is there a clean way to tell gitdags/TikZ to offset a node vertically like this?

share|improve this question
Perhaps add a tag for gitdags? If it doesn't exist, it'd be great to create one for it :) – cmhughes Feb 14 at 14:12
@cmhuges I tried but I don't have the reputation :} – Daniel Rocco Feb 15 at 14:29
No problem :) done! your question is the first to be tagged with gitdags :) :) :) – cmhughes Feb 17 at 14:04
up vote 4 down vote accepted

I don't know if this counts as "cleaner" (and I also don't know the gitdags package) but anyway:

  nudge down/.style={nudge=(270:#1)},
  nudge down/.default=1
\gitDAG[grow right sep = 2em]{
  {[nodes=placeholder commits] "..."}  -- A -- B -- C -- 
  {[nudge down]
    D -- E;

enter image description here

share|improve this answer
This is great! Yes, your solution is cleaner than mine: it lets us express our actual intent, rather than tricking TikZ with an invisible node hack. Thanks! :) – Daniel Rocco Feb 17 at 14:34

My current solution, used to generate the graph in the question, is to create an invisible node along the master branch, which forces the node D to the next row:

\gitDAG[grow right sep = 2em]{
  {[nodes=placeholder commits] "..." } -- A -- B -- C -- {
    "" [placeholder];
    D [>opacity=0.75] -- E;

The "" [placeholder]; bit creates the invisible node after C along the master branch; D represents a parallel line of development and therefore is vertically aligned with the invisible node.

This trick gets the job done but feels very hackish, especially since we have to reset the edge opacity when we are done ([>opacity=0.75]). Without this reset, nodes D and E will be rendered but their edges will not.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.