Skip to content

Instantly share code, notes, and snippets.

@amorphobia
Created April 26, 2020 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amorphobia/3d013294f5a1843f8bf8cd3bfc7ff102 to your computer and use it in GitHub Desktop.
Save amorphobia/3d013294f5a1843f8bf8cd3bfc7ff102 to your computer and use it in GitHub Desktop.
TiKZ code for the first pic in the thread https://www.v2ex.com/t/665886
\documentclass[preview]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows}
\tikzset{default/.style={draw,inner sep=10pt}}
\tikzset{else master/.style={draw=gray!60,inner sep=10pt}}
\tikzset{feature/.style={draw,inner sep=10pt,fill=gray}}
\tikzset{master/.style={draw,inner sep=10pt,fill=blue!20}}
\tikzset{rect/.style={rectangle,minimum height=25pt,minimum width=60pt}}
\tikzset{
pics/ast/.style={
code={
\path[draw,line width=2.3pt,line cap=round] (-3pt,0) -- (3pt,0);
\path[draw,line width=2.3pt,line cap=round] (0,-3pt) -- (0,3pt);
\path[draw,line width=2.3pt,line cap=round] (-2.12pt,-2.12pt) -- (2.12pt,2.12pt);
\path[draw,line width=2.3pt,line cap=round] (-2.12pt,2.12pt) -- (2.12pt, -2.12pt);
}
}
}
\tikzset{
pics/arrow/.style={
code={
\path[draw,line width=2.3pt,line cap=round] (-10pt,0) -- (10pt,0);
\path[draw,line width=2.3pt,line cap=round] (2pt,-8pt) -- (10pt,0);
\path[draw,line width=2.3pt,line cap=round] (2pt,8pt) -- (10pt,0);
}
}
}
\begin{document}
\begin{tikzpicture}[line width=2pt]
\node[default,circle] (n0) {};
\node[default,circle] at ($(n0)+(60pt,0)$) (n1) {};
\path[draw] (n0.east) -- (n1.west);
\node[else master,circle] at ($(n1)+(120pt,0)$) (n2) {};
\node[else master,circle] at ($(n2)+(60pt,0)$) (n3) {};
\path[draw=gray!60] (n1.east) -- (n2.west);
\path[draw=gray!60] (n2.east) -- (n3.west);
\node[feature,circle] at ($(n2)+(0,50pt)$) (n4) {};
\node[feature,circle] at ($(n4)+(60pt,0)$) (n5) {};
\path[draw,rounded corners=25pt] (n1.east) -- ++ (50pt, 0) -- ++ (0, 50pt) -- (n4.west);
\path[draw] (n4.east) -- (n5.west);
\node[feature,circle] at ($(n5)+(60pt,0)$) (n6) {};
\node[master,circle] at ($(n6)+(60pt,0)$) (n7) {};
\pic[scale=1.8] at ($(n7)$) {ast};
\node[master,circle] at ($(n7)+(60pt,0)$) (n8) {};
\pic[scale=1.8] at ($(n8)$) {ast};
\path[draw] (n5.east) -- (n6.west);
\path[draw] (n6.east) -- (n7.west);
\path[draw] (n7.east) -- (n8.west);
\node[else master,rect] at ($(n3)+(0,-70pt)$) {\textsf{Master}};
\pic[rotate=90,scale=0.8,draw=gray!60] at ($(n3)+(0,-35pt)$) {arrow};
\node[feature,rect] at ($(n6)+(0,70pt)$) {\textsf{Feature}};
\pic[rotate=270,scale=0.8] at ($(n6)+(0,35pt)$) {arrow};
\node[master,rect] at ($(n8)+(0,70pt)$) {\textsf{Master}};
\pic[rotate=270,scale=0.8] at ($(n8)+(0,35pt)$) {arrow};
\node[align=center] at ($(n8)+(0,-75pt)$) {\textsf{Your}\\\textsf{master}\\\textsf{branch}};
\pic[rotate=90,scale=0.8] at ($(n8)+(0,-35pt)$) {arrow};
\node[align=center] at ($(n3)+(100pt,-60pt)$) (comment1) {\textsf{Everybody else's}\\\textsf{master branch}};
\path[draw] ($(comment1.north)+(0,10pt)$) edge[-{angle 90},bend right=20] ($(n3.east)+(10pt,0)$);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment