├── README.md
├── generate.html
└── tig-cheat-sheet.tex
/README.md:
--------------------------------------------------------------------------------
1 | tig-cheat-sheet
2 | ===============
3 |
4 | A cheat sheet for tig (Text-mode Interface for Git)
5 |
6 | If you can't find the last version of the tig cheat sheet in the [release section of github](/releases),
7 | you could generate the last version from [this page](http://rawgit.com/pmiossec/tig-cheat-sheet/master/generate.html).
8 |
--------------------------------------------------------------------------------
/generate.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Tig cheat sheat
5 |
6 |
7 |
8 |
9 |
24 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/tig-cheat-sheet.tex:
--------------------------------------------------------------------------------
1 | \documentclass[10pt,landscape]{article}
2 | \usepackage{multicol}
3 | \usepackage{ifthen}
4 | \usepackage[landscape]{geometry}
5 | \usepackage{hyperref}
6 |
7 | % Build a pdf online with:
8 | % http://latex.informatik.uni-halle.de/latex-online/latex.php?spw=2&id=626837_hRLskRF34GHL
9 |
10 | % To make this come out properly in landscape mode, do one of the following
11 | % 1.
12 | % pdflatex latexsheet.tex
13 | %
14 | % 2.
15 | % latex latexsheet.tex
16 | % dvips -P pdf -t landscape latexsheet.dvi
17 | % ps2pdf latexsheet.ps
18 |
19 | % This sets page margins to .5 inch if using letter paper, and to 1cm
20 | % if using A4 paper. (This probably isn't strictly necessary.)
21 | % If using another size paper, use default 1cm margins.
22 | \ifthenelse{\lengthtest { \paperwidth = 11in}}
23 | { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
24 | {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
25 | {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
26 | {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
27 | }
28 |
29 | % Turn off header and footer
30 | \pagestyle{empty}
31 |
32 |
33 | % Redefine section commands to use less space
34 | \makeatletter
35 | \renewcommand{\section}{\@startsection{section}{1}{0mm}%
36 | {-1ex plus -.5ex minus -.2ex}%
37 | {0.5ex plus .2ex}%x
38 | {\normalfont\large\bfseries}}
39 | \renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
40 | {-1explus -.5ex minus -.2ex}%
41 | {0.5ex plus .2ex}%
42 | {\normalfont\normalsize\bfseries}}
43 | \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}%
44 | {-1ex plus -.5ex minus -.2ex}%
45 | {1ex plus .2ex}%
46 | {\normalfont\small\bfseries}}
47 | \makeatother
48 |
49 | % Don't print section numbers
50 | \setcounter{secnumdepth}{0}
51 |
52 |
53 | \setlength{\parindent}{0pt}
54 | \setlength{\parskip}{0pt plus 0.5ex}
55 |
56 |
57 | % -----------------------------------------------------------------------
58 |
59 | \begin{document}
60 |
61 | \raggedright
62 | \footnotesize
63 | \begin{multicols}{3}
64 |
65 |
66 | % multicol parameters
67 | % These lengths are set only within the two main columns
68 | %\setlength{\columnseprule}{0.25pt}
69 | \setlength{\premulticols}{1pt}
70 | \setlength{\postmulticols}{1pt}
71 | \setlength{\multicolsep}{1pt}
72 | \setlength{\columnsep}{2pt}
73 |
74 | \begin{center}
75 | \Large{\textbf{Tig Cheat Sheet}} \\
76 | \end{center}
77 |
78 | \section{Switch between views}
79 | \begin{tabular}{@{}ll ll ll@{}}
80 | \verb!m! & \verb!Main!. & \verb!p! & \verb!Pager!. & \verb!t! & \verb!Directory! tree.\\
81 | \verb!d! & \verb!Diff!. & \verb!r! & \verb!Refs!. & \verb!f! & \verb!File! blob.\\
82 | \verb!l! & \verb!Log!. & \verb!S! & \verb!Status!. & \verb!y! & \verb!Stash!.\\
83 | \verb!B! & \verb!Blame!. & \verb!c! & \verb!Stage!. & \verb!h! & \verb!Help!.\\
84 | \end{tabular}
85 |
86 | \section{Cursor Navigation}
87 | \begin{tabular}{@{}ll@{}}
88 | \verb!k! / \verb!j! & Move cursor one line \verb!up! / \verb!down!. \\
89 | \verb!PgUp,-,a! & Move cursor one page up. \\
90 | \verb!PgDown, Space! & Move cursor one page down. \\
91 | \verb!Home! / \verb!End! & Jump to \verb!first! / \verb!last! line. \\
92 | \end{tabular}
93 |
94 | \section{View Manipulation}
95 | \begin{tabular}{@{}lp{6.5cm}@{}}
96 | \verb!q! & Close current view, go to previous one until last. \\
97 | \verb!Q! & Quit tig. \\
98 | \verb!Enter! & Split the view to show the commit diff / In the diff view, scroll the view one line down. \\
99 | \verb!Tab! & Switch to next view. \\
100 | \verb!R! & Reload and refresh the current view. \\
101 | \verb!O! & Maximize the current view to fill the whole display. \\
102 | \verb!Up! & Move the cursor one line up. In diff view from the main view, point to the previous commit and update the diff view to display it. \\
103 | \verb!Down! & Similar to Up but will move down. \\
104 | \verb!,! & Move to parent. \\
105 | \end{tabular}
106 |
107 | \section{Scrolling}
108 | \begin{tabular}{@{}ll@{}}
109 | \verb!Insert! / \verb!Delete! & Scroll view one line \verb!up! / \verb!down!. \\
110 | \verb!w! / \verb!s! & Scroll view one page \verb!up! / \verb!down!. \\
111 | \verb!Left! / \verb!Right!& Scroll view one column \verb!left! / \verb!right!. \\
112 | \verb!|! & Scroll view to the first column. \\
113 | \end{tabular}
114 |
115 | \section{Searching}
116 | \begin{tabular}{@{}ll@{}}
117 | \verb!/! & Search the view using RegExp. \\
118 | \verb!?! & Search backwards. \\
119 | \verb!n! / \verb!N! & Find \verb!next! / \verb!previous! match. \\
120 | \end{tabular}
121 |
122 | \section{View Specific Actions}
123 | \begin{tabular}{@{}lp{6.5cm}@{}}
124 | \verb!u! & Update status of file.\\
125 | \verb!M! & Resolve unmerged file by launching git-mergetool. \\
126 | \verb#!# & Checkout file (reset its content). \\
127 | \verb!1! & Stage single diff line. \\
128 | \verb!@! & Move to next chunk in the stage view. \\
129 | \verb!]! / \verb![! & \verb!Increase! / \verb!Decrease! the diff context. \\
130 | \end{tabular}
131 |
132 | \section{Main View (m)}
133 | \begin{tabular}{@{}lp{6.5cm}@{}}
134 | \verb!C! & Cherry-pick the current commit (e.g. git cherry-pick \%(commit)). \\
135 | \end{tabular}
136 |
137 | \section{Diff View (d)}
138 | \begin{tabular}{@{}lp{6.5cm}@{}}
139 | \verb!k! / \verb!j! & Move cursor one line \verb!up! / \verb!down! \\
140 | \verb!Up! / \verb!Down! & Go to \verb!previous! / \verb!next! commit and update the diff view. \\
141 | \end{tabular}
142 |
143 | \section{Blame View (B)}
144 | \begin{tabular}{@{}lp{6.5cm}@{}}
145 | \verb!,! & Load blame for the parent commit (Parent is queried for merges). \\
146 | \end{tabular}
147 |
148 | \section{Refs View(r)}
149 | \begin{tabular}{@{}lp{6.5cm}@{}}
150 | \verb!Enter! & Open commit log view. \\
151 | \verb!C! & Checkout current branch (e.g. git checkout \%(branch)). \\
152 | \end{tabular}
153 |
154 | \section{Status View (S)}
155 | \begin{tabular}{@{}lp{6.5cm}@{}}
156 | \verb!u! & Add or stage file.\\
157 | \verb!M! & Resolve unmerged file by launching git-mergetool. \\
158 | \verb#!# & Checkout file (reset its content). \\
159 | \verb!1! & Stage single diff line. \\
160 | \verb!@! & Move to next chunk in the stage view. \\
161 | \verb!]! / \verb![! & \verb!Increase! / \verb!Decrease! the diff context. \\
162 | \verb!C! & Commit (e.g. git commit) \\
163 | \end{tabular}
164 |
165 | \section{Stage View (c)}
166 | \begin{tabular}{@{}lp{6.5cm}@{}}
167 | \verb!u! & Stage only chunk for next commit (on a diff chunk), otherwise stage all changes. \\
168 | \end{tabular}
169 |
170 | \section{Tree View (t)}
171 | \begin{tabular}{@{}lp{6.5cm}@{}}
172 | \verb!,! & Switch to the parent directory. \\
173 | \end{tabular}
174 |
175 | \section{Prompt (:)}
176 | \begin{tabular}{@{}ll@{}}
177 | \textbf{:\textless number\textgreater} & Jump to the specific line number, e.g. :80. \\
178 | \textbf{:\textless sha\textgreater} & Jump to a specific commit, e.g. :2f12bcc. \\
179 | \textbf{:\textless x\textgreater} & Execute the corresponding key binding, e.g. :q. \\
180 | \textbf{:!\textless cmd\textgreater} & Run a command, e.g. :!git log -p. \\
181 | \textbf{:\textless action\textgreater} & Execute a Tig command, e.g. :edit. \\
182 | \end{tabular}
183 |
184 | \section{Misc / Options}
185 | \begin{tabular}{@{}lp{6.5cm}@{}}
186 | \verb!r! & Redraw screen. \\
187 | \verb!z! & Stop all background loading (a repository with a long history without limiting the revision log) \\
188 | \verb!v! & Show version. \\
189 | \verb!o! & Open option menu \\
190 | \verb!.! & Toggle line numbers on/off. \\
191 | \verb!D! & Toggle date display on/off/short/relative/local. \\
192 | \verb!A! & Toggle author display on/off/abbreviated /email/email user name. \\
193 | \verb!g! & Toggle revision graph visualization on/off. \\
194 | \verb!~! & Toggle (line) graphics mode \\
195 | \verb!F! & Toggle reference (tag and branch) display on/off. \\
196 | \verb!W! & Toggle ignoring whitespace on/off for diffs \\
197 | \verb!X! & Toggle commit ID display on/off \\
198 | \verb!%! & Toggle file filtering in order to see the full diff instead of only the diff concerning the currently selected file. \\
199 | \verb!$! & Toggle highlighting of commit title overflow. \\
200 | \verb!:! & Open prompt to run a command. \\
201 | \verb!e! & Open file in editor. \\
202 | \verb!G! & Run garbage collection (e.g. git gc) \\
203 | \end{tabular}
204 |
205 | \section{External Commands}
206 | Provide a way to easily execute a script or program.
207 | Bound to keys and use information from the current browsing state (e.g current commit ID).
208 |
209 | Built-in external commands:
210 | \begin{tabular}{@{}lll@{}}
211 | \verb!main! & \verb!C! & git cherry-pick \%(commit)\\
212 | \verb!status! & \verb!C! & git commit \\
213 | \verb!generic! & \verb!G! & git gc \\
214 | \end{tabular}
215 |
216 |
217 | \section{Set your custom bind Commands}
218 |
219 | In the .gitconfig file, under the \verb![tig "bind"]! section, use pattern:
220 | keymap = key action
221 |
222 | \begin{tabular}{@{}lp{6.5cm}@{}}
223 | \verb!Keymaps! & main, diff, log, help, pager, status, stage, tree, blob, blame, branch, and generic (global keymap)\\
224 | \verb!Special Keys! & Enter, Space, Backspace, Tab, Escape, Left, Right, Up, Down, Insert, Delete, Hash, Home, End, PageUp, PageDown, F1,..., F12\\
225 | \end{tabular}
226 | note: use \^{} to set a keymap with the ctrl key (\^{}j for ctrl-j)
227 |
228 | \subsection{External command control flags:}
229 | \begin{tabular}{@{}lp{6.5cm}@{}}
230 | \verb!@! & Run the command in background (no output).\\
231 | \verb!?! & Prompt the user before running the command.\\
232 | \verb!