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