File: GitCheatSheet.tex

package info (click to toggle)
insighttoolkit5 5.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704,404 kB
  • sloc: cpp: 783,697; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 461; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (223 lines) | stat: -rw-r--r-- 5,670 bytes parent folder | download | duplicates (2)
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
\documentclass[10pt]{article}
\usepackage[top=2.75cm, bottom=0cm, left=1.5cm, right=1.5cm]{geometry}

% Discourage hyphenation - doesn't look as good in CVs.
\hyphenpenalty=5000
\tolerance=1000

% Adjust lengths
\setlength{\headheight}{0cm}
\setlength{\headsep}{0cm}
\setlength{\footskip}{0cm}

\setlength{\parindent}{0cm}

% New lengths and commands for my CV
\newcommand{\HR}{\rule{0.5cm}{0.5pt}}
\newlength{\cvsep}
\setlength{\cvsep}{0.3cm}
\newlength{\vcvsep}
\setlength{\vcvsep}{0.2cm}
\newlength{\cvtitles}
\setlength{\cvtitles}{2.9cm}
\newlength{\cvmain}
\setlength{\cvmain}{\textwidth}
\addtolength{\cvmain}{-\cvtitles}
\addtolength{\cvmain}{-\cvsep}

% Category environment
\newenvironment{category}[1]
  {\parbox[t]{\cvtitles}{\large\sc\centering #1}\hspace*{\cvsep}\begin{minipage}[t]{\cvmain}}
  {\end{minipage}\vspace*{0.35cm}}

% 21st century - make some real links in the PDF, but keep the colors reasonable...
\usepackage{url}
\usepackage[colorlinks=true,urlcolor=blue,citecolor=black,linkcolor=black,final=true]{hyperref}

\begin{document}

\pagestyle{empty}

{\centering
  \huge \bf ITK Git Reference
  \vspace*{0.1cm}
  \hrule
}
\vspace*{0.3cm}

\subsection*{One-time Global Setup}
\begin{category}{Setup User Information}
\parbox[t]{0.6\cvmain}{%
\texttt{git config --global user.name "Jane Doe"\\
git config --global user.email "jane@doe.org"\\
git config --global color.ui auto}}
\parbox[t]{0.38\cvmain}{%
Use your full name.\\
\\
Enable color output in Git (optional).
}
\end{category}

\subsection*{Create and Configure Your Repository}
\begin{category}{Clone Repository}
\parbox[t]{0.6\cvmain}{%
  \texttt{git clone https://github.com/InsightSoftwareConsortium/ITK\\ cd ITK}
}
\parbox[t]{0.38\cvmain}{%
}
\end{category}
\begin{category}{Configure}
\parbox[t]{0.6\cvmain}{%
  \texttt{./Utilities/SetupForDevelopment.sh}
}
\parbox[t]{0.38\cvmain}{%
Follow prompts, sets up local hooks, remotes, push URLs etc.
}
\end{category}

\subsection*{Topic Branch Lifecycle}
\begin{category}{Update}
\parbox[t]{0.6\cvmain}{%
  \texttt{git status\\ git checkout master\\ git pull --rebase upstream master}
}
\parbox[t]{0.38\cvmain}{%
Review local modifications, delete, stash or commit them.
}
\end{category}
\begin{category}{New Topic Branch}
\parbox[t]{0.6\cvmain}{%
  \texttt{git checkout -b my-topic upstream/master}
}
\parbox[t]{0.38\cvmain}{%
Create branch off master.
}
\end{category}
\begin{category}{Write Code}
\parbox[t]{0.6\cvmain}{%
  \texttt{vim MyExistingFile.cxx MyNewFile.cxx}
}
\parbox[t]{0.38\cvmain}{%
Use your favorite editor.
}
\end{category}
\begin{category}{New Commit}
\parbox[t]{0.6\cvmain}{%
  \texttt{git add MyExistingFile.cxx MyNewFile.cxx\\
  git commit}
}
\parbox[t]{0.38\cvmain}{%
Stage changes to existing and new files.\\
Commit changes locally.
}
\end{category}
\begin{category}{Amend Commit}
\parbox[t]{0.6\cvmain}{%
  \texttt{vim MyExistingFile.cxx\\
  git add MyExistingFile.cxx\\
  git commit --amend}
}
\parbox[t]{0.38\cvmain}{%
Edit the file.\\
Stage changes.\\
Amend previous commit locally.
}
\end{category}
\begin{category}{Add Testing Data}
\parbox[t]{0.6\cvmain}{%
  \texttt{git data-upload DataFile.png\\
  \# Add DATA\{DataFile.png\} to CMakeLists.txt\\
  git add -- DataFile.png.cid CMakeLists.txt\\
  git commit --amend}
}
\parbox[t]{0.38\cvmain}{%
Upload a testing data input or baseline image to
  \href{https://content-link-upload.itk.org}{content-link-upload.itk.org}.\\
  Reference the content link in the CMake configuration.\\
  Add the content link and updated CMake configuration.
}
\end{category}
\begin{category}{Submit for Review}
\parbox[t]{0.6\cvmain}{%
  \texttt{git prepush\\ git review-push}
}
\parbox[t]{0.38\cvmain}{%
Check what will be pushed to GitHub.\\
Push the topic to GitHub for review.
Enter the URL returned in your browser, and review and open the pull request.
}
\end{category}
\begin{category}{Respond to Review}
\parbox[t]{0.6\cvmain}{%
  % sim -> Improved tilde
  \texttt{git rebase -i HEAD{\raise.17ex\hbox{$\scriptstyle\sim$}}3\\ git prepush\\ git review-push --force}
}
\parbox[t]{0.38\cvmain}{%
Modify local commits (3 back here).\\
Check what will be pushed to Gerrit.\\
Push the updated topic to Gerrit.
}
\end{category}
\begin{category}{Delete Topic}
\parbox[t]{0.6\cvmain}{%
  \texttt{git fetch upstream\\ git branch -d my-topic}
}
\parbox[t]{0.38\cvmain}{%
Fetch the latest changes from origin.\\
Delete topic, fails if not merged.
}
\end{category}

\newpage
\subsection*{Review}
\begin{category}{Push for Review}
\parbox[t]{0.6\cvmain}{%
  \texttt{git review-push}
}
\parbox[t]{0.38\cvmain}{%
Push the current topic branch for review.
}
\end{category}
\begin{category}{Review Pull Requests}
\parbox[t]{0.6\cvmain}{%
  \texttt{git pr $<$pull-request-number$>$}
}
\parbox[t]{0.38\cvmain}{%
Fetch and check out by number a pull request locally for review.
}
\end{category}
\begin{category}{Clean Pull Requests}
\parbox[t]{0.6\cvmain}{%
  \texttt{git pr-clean}
}
\parbox[t]{0.38\cvmain}{%
Clean locally fetched pull requests.
}
\end{category}

\subsection*{General Guidelines}
\begin{category}{Commit Message}
\parbox[t]{0.6\cvmain}{%
  \texttt{<short-description>\\ \\ <long description>\\ Issue \#1234}
}
\parbox[t]{0.38\cvmain}{%
Should be less than 78 characters.\\
Blank line after short description.\\
Could be several paragraphs.\\
GitHub issue number, if applicable.
}
\end{category}
\begin{category}{Topic Naming}
\parbox[t]{0.6\cvmain}{%
  \texttt{summary-of-topic}
}
\parbox[t]{0.38\cvmain}{%
Lower case, separated by dashes.
}
\end{category}


\begin{center}
For more information, see \href{https://git-scm.com/}{git-scm.com}.
\end{center}

\end{document}