forked from vedang/csaoid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagit-cheatsheet.html
336 lines (232 loc) · 15.9 KB
/
magit-cheatsheet.html
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en" xml:lang="en">
<head>
<title>Magit Cheatsheet</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2009/09/24 10:39:13"/>
<meta name="author" content="daemian"/>
<style type="text/css">
html {font-family: Times, serif; font-size: 90%;}
.preamble {font-variant: italic; margin-bottom:40px;}
.title {text-align: center;}
h2 {margin-top:40px;
margin-bottom:1px;
font-variant: small-caps;
background-color:#A65B5B;
color:#FFFFFF;
font-size:1.5em;
text-align:center;
}
table {border: 0px solid transparent; width:100%;}
td {border-collapse:collapse; border: 1px solid #fff;}
td, th {vertical-align: top;}
td.command, td.description, td.notes {background-color: #F0E4E4;}
td.command, td.description {white-space: nowrap;}
td.command {font-family:monospace; font-size: 130%; font-weight: 600; width:10em;}
td.notes {color: #666; font-variant: italic;}
</style>
</head><body>
<div class="preamble">This is a distillation of the <a
href="http://philjackson.github.com/magit/magit.html">Magit user
manual</a>, which has more detail than this quick cheatsheet
provides. Read the user manual!</div>
<h1 class="title">Magit Cheatsheet</h1>
<h2>Table of Contents</h2>
<ul>
<li><a href="#sec-1">Buffers</a></li>
<li><a href="#sec-2">Section Visibility</a></li>
<li><a href="#sec-3">Untracked Files</a></li>
<li><a href="#sec-4">Staging and Committing</a></li>
<li><a href="#sec-5">History</a></li>
<li><a href="#sec-6">Reflogs</a></li>
<li><a href="#sec-7">Diffing</a></li>
<li><a href="#sec-8">Tagging</a></li>
<li><a href="#sec-9">Resetting</a></li>
<li><a href="#sec-10">Stashing</a></li>
<li><a href="#sec-11">Branching</a></li>
<li><a href="#sec-12">Wazzup</a></li>
<li><a href="#sec-13">Merging</a></li>
<li><a href="#sec-14">Rebasing</a></li>
<li><a href="#sec-15">Rewriting</a></li>
<li><a href="#sec-16">Pushing and Pulling</a></li>
<li><a href="#sec-17">Interfacing with Subversion</a></li>
</ul>
<h2><a name="sec-1">Buffers</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">M-x magit-status</td><td class="description">Magit's status buffer</td><td class="notes">The main entry point to Magit, and the context where the commands described in this cheatsheet are meant to be executed. Probably a good idea to bind magit-status to a key.</td></tr>
<tr><td class="command">$</td><td class="description">magit-process buffer</td><td class="notes">Behind-the-scenes. Displays the git command and its output.</td></tr>
<tr><td class="command">g</td><td class="description">reload status buffer</td><td class="notes">Necessary to update an existing Magit status buffer after saving a file in emacs, or after making changes to repo outside of emacs.</td></tr>
</tbody>
</table>
<h2><a name="sec-2">Section Visibility</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">TAB</td><td class="description">Toggle visibility of current section</td><td class="notes"></td></tr>
<tr><td class="command">S-TAB</td><td class="description">Toggle visibility of current section and its children</td><td class="notes"></td></tr>
<tr><td class="command">1,2,3,4</td><td class="description">Expand current section to the corresponding level of detail - 1, 2, 3 or 4</td><td class="notes">e.g., 4 will show all detail for the current section.</td></tr>
<tr><td class="command">M-1,2,3,4</td><td class="description">Expand all sections to the corresponding level of detail - 1, 2, 3 or 4</td><td class="notes">e.g., M-4 will show all detail for the entire buffer.</td></tr>
</tbody>
</table>
<h2><a name="sec-3">Untracked Files</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">s</td><td class="description">Add untracked file to staging area</td><td class="notes"></td></tr>
<tr><td class="command">i</td><td class="description">Add file to .gitignore</td><td class="notes"></td></tr>
<tr><td class="command">C-u i</td><td class="description">Prompt for file/directory to add to .gitignore</td><td class="notes"></td></tr>
<tr><td class="command">I</td><td class="description">Add file to .git/info/exclude instead of .gitignore</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-4">Staging and Committing</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">s</td><td class="description">Stage current hunk</td><td class="notes">If point is in diff header, will stage all hunks belonging to current diff. If a region is active, only lines in that region will be staged. This is a distinct improvement on the conventional 'git add -p', the splitting mechanics of which are... 'imperfect'.</td></tr>
<tr><td class="command">u</td><td class="description">Unstage current hunk</td><td class="notes">As with s command, only in reverse: diff headers and regions provide a corresponding context to the unstage action.</td></tr>
<tr><td class="command">S</td><td class="description">Stage all hunks</td><td class="notes"></td></tr>
<tr><td class="command">U</td><td class="description">Unstage all hunks</td><td class="notes"></td></tr>
<tr><td class="command">k</td><td class="description">Discard uncommitted changes</td><td class="notes">As with s command.</td></tr>
<tr><td class="command">c</td><td class="description">Prepare for commit</td><td class="notes">Pops up <b>magit-log-edit</b> buffer. to allow you to enter your commit message.</td></tr>
<tr><td class="command">C-c C-c</td><td class="description">Execute commit</td><td class="notes">Actually triggers commit action. Fire this inside the <b>magit-log-edit</b> commit message buffer. To postpone the commit for later, just C-x b to a different buffer and come back to this buffer when you're ready,</td></tr>
<tr><td class="command">C-c C-a</td><td class="description">Make the next commit an amend</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-5">History</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">l</td><td class="description">History</td><td class="notes">Shows terse history for repository.</td></tr>
<tr><td class="command">L</td><td class="description">Verbose history</td><td class="notes"></td></tr>
<tr><td class="command">C-u l</td><td class="description">History segment</td><td class="notes">Will prompt for beginning and end points.</td></tr>
<tr><td class="command">RET</td><td class="description">Inspect commit</td><td class="notes">Shows full information for commit and move point into the new buffer.</td></tr>
<tr><td class="command">a</td><td class="description">Stage current commit on your current branch</td><td class="notes">Useful to cherrypick changes while browsing an alternative branch. Cherrypicked changes need to be committed manually.</td></tr>
<tr><td class="command">A</td><td class="description">Commit current commit on your current branch</td><td class="notes">As with 'a', but will automatically commit changes when there aren't any conflicts.</td></tr>
<tr><td class="command">C-w</td><td class="description">Copy sha1 of current commit into kill ring</td><td class="notes"></td></tr>
<tr><td class="command">=</td><td class="description">Show differences between current and marked commits</td><td class="notes"></td></tr>
<tr><td class="command">..</td><td class="description">Mark current commit</td><td class="notes"></td></tr>
<tr><td class="command">.</td><td class="description">Unmark current commit if marked</td><td class="notes"></td></tr>
<tr><td class="command">C-u ..</td><td class="description">Unmark marked commit from anywhere</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-6">Reflogs</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">h</td><td class="description">Browse reflog from HEAD</td><td class="notes">Reflog buffer works just like History buffer described above.</td></tr>
<tr><td class="command">H</td><td class="description">Browse reflog from chosen point</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-7">Diffing</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">d</td><td class="description">Show changes between working tree and HEAD</td><td class="notes"></td></tr>
<tr><td class="command">D</td><td class="description">Show changes between two arbitrary revisions</td><td class="notes"></td></tr>
<tr><td class="command">a</td><td class="description">Apply current changes to working tree</td><td class="notes">Change-selection works as described in 'Staging and Committing' above.</td></tr>
<tr><td class="command">v</td><td class="description">Apply current changes to working tree in reverse</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-8">Tagging</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">t</td><td class="description">Make lightweight tag</td><td class="notes"></td></tr>
<tr><td class="command">T</td><td class="description">Prepare annotated tag</td><td class="notes">Launches <b>magit-log-edit</b> buffer for writing annotation.</td></tr>
<tr><td class="command">C-c C-c</td><td class="description">Commit annotated tag</td><td class="notes">Actually triggers annotated tag action.</td></tr>
</tbody>
</table>
<h2><a name="sec-9">Resetting</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">x</td><td class="description">Reset your current head to chosen revision</td><td class="notes">No changes will be made to working tree or staging area. Typing x while point is in a line describing a commit will offer this commit as the default revision to reset to.</td></tr>
<tr><td class="command">X</td><td class="description">Reset working tree and staging area to most recent committed state</td><td class="notes">Destructive! Will discard all local modifications.</td></tr>
</tbody>
</table>
<h2><a name="sec-10">Stashing</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">z</td><td class="description">Create new stash</td><td class="notes">Stashes are listed in the status buffer.</td></tr>
<tr><td class="command">Z</td><td class="description">Create new stash and maintain state</td><td class="notes">Leaves current changes in working tree and staging area.</td></tr>
<tr><td class="command">RET</td><td class="description">View stash</td><td class="notes"></td></tr>
<tr><td class="command">a</td><td class="description">Apply stash</td><td class="notes"></td></tr>
<tr><td class="command">A</td><td class="description">Pop stash</td><td class="notes"></td></tr>
<tr><td class="command">k</td><td class="description">Drop stash</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-11">Branching</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">b</td><td class="description">Switch to different branch</td><td class="notes">Current branch is indicated in header of status buffer.</td></tr>
<tr><td class="command">B</td><td class="description">Create and switch to new branch</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-12">Wazzup</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">w</td><td class="description">Show summary of how other branches relate to current branch</td><td class="notes"></td></tr>
<tr><td class="command">i</td><td class="description">Toggle ignore branch</td><td class="notes"></td></tr>
<tr><td class="command">C-u w</td><td class="description">Show all branches including ignored ones</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-13">Merging</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">m</td><td class="description">Initiate manual merge</td><td class="notes">Applies all changes to working area and index, without committing.</td></tr>
<tr><td class="command">M</td><td class="description">Initiate automatic merge</td><td class="notes">Applies all changes to working area and index. Commits changes immediately.</td></tr>
</tbody>
</table>
<h2><a name="sec-14">Rebasing</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">R</td><td class="description">Initiate or continue a rebase</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-15">Rewriting</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">r s</td><td class="description">Start a rewrite</td><td class="notes"></td></tr>
<tr><td class="command">v</td><td class="description">Revert a given commit</td><td class="notes"></td></tr>
<tr><td class="command">r t</td><td class="description">Remove bookkeeping information from buffer</td><td class="notes"></td></tr>
<tr><td class="command">r a</td><td class="description">Abort rewriting</td><td class="notes"></td></tr>
<tr><td class="command">r f</td><td class="description">Finish rewriting</td><td class="notes">Applies all unused commits.</td></tr>
<tr><td class="command">r *</td><td class="description">Toggle the * mark on a pending commit</td><td class="notes"></td></tr>
<tr><td class="command">r ..</td><td class="description">Toggle the . mark on a pending commit</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-16">Pushing and Pulling</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">P</td><td class="description">git push</td><td class="notes">Uses default remote repository.</td></tr>
<tr><td class="command">C-u P</td><td class="description">git push to specified remote repository</td><td class="notes"></td></tr>
<tr><td class="command">f</td><td class="description">git remote update</td><td class="notes"></td></tr>
<tr><td class="command">F</td><td class="description">git pull</td><td class="notes"></td></tr>
</tbody>
</table>
<h2><a name="sec-17">Interfacing with Subversion</a></h2>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<COL align="left"><COL align="left"><COL align="left">
<tbody>
<tr><td class="command">N r</td><td class="description">git svn rebase</td><td class="notes"></td></tr>
<tr><td class="command">N c</td><td class="description">git svn dcommit</td><td class="notes"></td></tr>
</tbody>
</table>
<p class="author"> Author: daemian
<a href="mailto:daemian@rodak"><daemian@rodak></a>
</p>
<p class="date"> Date: 2009/09/24 10:39:13</p>
</body>
</html>