%load_ext jupyter_tikzload extension
preables
preamble = r"""
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
"""style_git_region = r"""
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
"""style_git_file = r"""
draw=black!70,
fill=lightgray!20,
minimum width=3cm,
minimum height=0.7cm,
rectangle,
line width=1pt
"""style_git_operation = r"""
draw=black!70,
-Triangle,
line width=1.2pt,
bend left=80,
looseness=1.4
"""style_git_pointer = r"""
draw=black!70,
-Triangle,
line width=1.2pt
"""figures
%%tikz -S fig_internal_01 -pt -e -tp xelatex -p "$preamble" -r -d 300
\begin{tikzpicture}
\begin{scope}[
every node/.style={(* style_git_region *)}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\end{tikzpicture}\documentclass{standalone}
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\end{tikzpicture}
\end{document}

%%tikz -S fig_internal_02 -pt -e -tp xelatex -p "$preamble" -r -d 300
\begin{tikzpicture}
\begin{scope}[
every node/.style={(* style_git_region *)}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={(* style_git_file *)}
]
\node (file1) at (0,2.5) {file1.txt};
\end{scope}
\end{tikzpicture}\documentclass{standalone}
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!20,
minimum width=3cm,
minimum height=0.7cm,
rectangle,
line width=1pt
}
]
\node (file1) at (0,2.5) {file1.txt};
\end{scope}
\end{tikzpicture}
\end{document}

%%tikz -S fig_internal_03 -pt -e -tp xelatex -p "$preamble" -r -d 300
\begin{tikzpicture}
\begin{scope}[
every node/.style={(* style_git_region *)}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={(* style_git_file *)}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\end{scope}
\begin{scope}[
every edge/.style={(* style_git_pointer *)}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\end{scope}
\end{tikzpicture}\documentclass{standalone}
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!20,
minimum width=3cm,
minimum height=0.7cm,
rectangle,
line width=1pt
}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\end{scope}
\begin{scope}[
every edge/.style={
draw=black!70,
-Triangle,
line width=1.2pt
}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\end{scope}
\end{tikzpicture}
\end{document}

%%tikz -S fig_internal_04 -pt -e -tp xelatex -p "$preamble" -r -d 300
\begin{tikzpicture}
\begin{scope}[
every node/.style={(* style_git_region *)}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={(* style_git_file *)}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\node (c1 tree) at (14,2.5) {c1 트리 객체};
\node (c1 commit) at (18,2.5) {c1 커밋 객체};
\end{scope}
\begin{scope}[
every edge/.style={(* style_git_pointer *)}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\draw (c1 tree) edge (file1 blob);
\draw (c1 commit) edge (c1 tree);
\end{scope}
\end{tikzpicture}\documentclass{standalone}
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!20,
minimum width=3cm,
minimum height=0.7cm,
rectangle,
line width=1pt
}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\node (c1 tree) at (14,2.5) {c1 트리 객체};
\node (c1 commit) at (18,2.5) {c1 커밋 객체};
\end{scope}
\begin{scope}[
every edge/.style={
draw=black!70,
-Triangle,
line width=1.2pt
}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\draw (c1 tree) edge (file1 blob);
\draw (c1 commit) edge (c1 tree);
\end{scope}
\end{tikzpicture}
\end{document}

%%tikz -S fig_internal_05 -pt -e -tp xelatex -p "$preamble" -r -d 300
\begin{tikzpicture}
\begin{scope}[
every node/.style={(* style_git_region *)}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={(* style_git_file *)}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file2) at (0,-0.5) {file2.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file2 entry) at (5,-0.5) {file2.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\node (file2 blob) at (10,-0.5) {file2.txt 블롭 객체};
\node (c1 tree) at (14,2.5) {c1 트리 객체};
\node (c1 commit) at (18,2.5) {c1 커밋 객체};
\end{scope}
\begin{scope}[
every edge/.style={(* style_git_pointer *)}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\draw (c1 tree) edge (file1 blob);
\draw (c1 commit) edge (c1 tree);
\draw (file2 entry) edge (file2);
\draw (file2 entry) edge (file2 blob);
\end{scope}
\end{tikzpicture}\documentclass{standalone}
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!20,
minimum width=3cm,
minimum height=0.7cm,
rectangle,
line width=1pt
}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file2) at (0,-0.5) {file2.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file2 entry) at (5,-0.5) {file2.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\node (file2 blob) at (10,-0.5) {file2.txt 블롭 객체};
\node (c1 tree) at (14,2.5) {c1 트리 객체};
\node (c1 commit) at (18,2.5) {c1 커밋 객체};
\end{scope}
\begin{scope}[
every edge/.style={
draw=black!70,
-Triangle,
line width=1.2pt
}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\draw (c1 tree) edge (file1 blob);
\draw (c1 commit) edge (c1 tree);
\draw (file2 entry) edge (file2);
\draw (file2 entry) edge (file2 blob);
\end{scope}
\end{tikzpicture}
\end{document}

%%tikz -S fig_internal_06 -pt -e -tp xelatex -p "$preamble" -r -d 300
\begin{tikzpicture}
\begin{scope}[
every node/.style={(* style_git_region *)}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={(* style_git_file *)}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file2) at (0,-0.5) {file2.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file2 entry) at (5,-0.5) {file2.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\node (file2 blob) at (10,-0.5) {file2.txt 블롭 객체};
\node (c1 tree) at (14,2.5) {c1 트리 객체};
\node (c1 commit) at (18,2.5) {c1 커밋 객체};
\node (c2 tree) at (14,1) {c2 트리 객체};
\node (sub tree) at (14,-0.5) {sub 트리 객체};
\node (c2 commit) at (18,1) {c2 커밋 객체};
\end{scope}
\begin{scope}[
every edge/.style={(* style_git_pointer *)}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\draw (c1 tree) edge (file1 blob);
\draw (c1 commit) edge (c1 tree);
\draw (file2 entry) edge (file2);
\draw (file2 entry) edge (file2 blob);
\draw (c2 tree) edge (file1 blob);
\draw (c2 tree) edge (sub tree);
\draw (sub tree) edge (file2 blob);
\draw (c2 commit) edge (c1 commit);
\draw (c2 commit) edge (c2 tree);
\end{scope}
\end{tikzpicture}\documentclass{standalone}
\usepackage{kotex}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\setmainfont{Noto Sans KR}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!10,
minimum width=4.5cm,
minimum height=4.5cm,
rectangle,
line width=2pt
}
]
\node (worktree) at (0,1) {};
\node (stage) at (5,1) {};
\node[minimum width=12.5cm] (repository) at (14,1) {};
\end{scope}
\node (worktree-label) at (0,-2) {\shortstack{워크트리\\(체크아웃 디렉토리) }};
\node (stage-label) at (5,-2) {\shortstack{인덱스 파일 (스테이지)\\.git/index}};
\node (repository-label) at (14,-2) {\shortstack{객체 디렉토리 (레포지토리)\\.git/objects/...}};
\begin{scope}[
every node/.style={
draw=black!70,
fill=lightgray!20,
minimum width=3cm,
minimum height=0.7cm,
rectangle,
line width=1pt
}
]
\node (file1) at (0,2.5) {file1.txt};
\node (file2) at (0,-0.5) {file2.txt};
\node (file1 entry) at (5,2.5) {file1.txt 엔트리};
\node (file2 entry) at (5,-0.5) {file2.txt 엔트리};
\node (file1 blob) at (10,2.5) {file1.txt 블롭 객체};
\node (file2 blob) at (10,-0.5) {file2.txt 블롭 객체};
\node (c1 tree) at (14,2.5) {c1 트리 객체};
\node (c1 commit) at (18,2.5) {c1 커밋 객체};
\node (c2 tree) at (14,1) {c2 트리 객체};
\node (sub tree) at (14,-0.5) {sub 트리 객체};
\node (c2 commit) at (18,1) {c2 커밋 객체};
\end{scope}
\begin{scope}[
every edge/.style={
draw=black!70,
-Triangle,
line width=1.2pt
}
]
\draw (file1 entry) edge (file1);
\draw (file1 entry) edge (file1 blob);
\draw (c1 tree) edge (file1 blob);
\draw (c1 commit) edge (c1 tree);
\draw (file2 entry) edge (file2);
\draw (file2 entry) edge (file2 blob);
\draw (c2 tree) edge (file1 blob);
\draw (c2 tree) edge (sub tree);
\draw (sub tree) edge (file2 blob);
\draw (c2 commit) edge (c1 commit);
\draw (c2 commit) edge (c2 tree);
\end{scope}
\end{tikzpicture}
\end{document}
