|
@@ -0,0 +1,257 @@
|
|
1
|
+*fugitive.txt* A Git wrapper so awesome, it should be illegal
|
|
2
|
+
|
|
3
|
+Author: Tim Pope <vimNOSPAM@tpope.org> *fugitive-author*
|
|
4
|
+License: Same terms as Vim itself (see |license|)
|
|
5
|
+
|
|
6
|
+This plugin is only available if 'compatible' is not set.
|
|
7
|
+
|
|
8
|
+INTRODUCTION *fugitive*
|
|
9
|
+
|
|
10
|
+Install in ~/.vim, or in ~\vimfiles if you're on Windows and feeling lucky.
|
|
11
|
+Vim 7.2 is recommended as it ships with syntax highlighting for many Git file
|
|
12
|
+types.
|
|
13
|
+
|
|
14
|
+If you're in a hurry to get started, here are some things to try:
|
|
15
|
+
|
|
16
|
+In any file in your repository, run |:Gedit| HEAD. Press <CR> to jump to the
|
|
17
|
+current branch. Press <CR> again to jump to the top most commit. Keep using
|
|
18
|
+<CR> to explore parent commits, trees, and blobs. Use C in a tree or blob to
|
|
19
|
+get back to the commit.
|
|
20
|
+
|
|
21
|
+Edit a file in the work tree and make some changes. Use |:Gdiff| to open up
|
|
22
|
+the indexed version. Use |do| and |dp| on various hunks to bring the files in
|
|
23
|
+sync, or use |:Gread| to pull in all changes. Write the indexed version to
|
|
24
|
+stage the file.
|
|
25
|
+
|
|
26
|
+Run |:Gstatus| to check your repository's status. Use "-" to stage and reset
|
|
27
|
+files and "p" to add/reset --patch them. Invoke |:Gcommit| to commit your
|
|
28
|
+changes.
|
|
29
|
+
|
|
30
|
+Run |:Gblame| in a work tree file to see a blame in a vertical split. Press
|
|
31
|
+<CR> on any line to reopen and reblame that file as it stood in that commit.
|
|
32
|
+Press o or O on any line to inspect that commit in a split or a tab.
|
|
33
|
+
|
|
34
|
+Run |:Ggrep| to search the work tree or history. Run |:Gmove| to rename a
|
|
35
|
+file. Run |:Gremove| to delete a file.
|
|
36
|
+
|
|
37
|
+COMMANDS *fugitive-commands*
|
|
38
|
+
|
|
39
|
+These commands are local to the buffers in which they work (generally, buffers
|
|
40
|
+that are part of Git repositories).
|
|
41
|
+
|
|
42
|
+ *fugitive-:Git*
|
|
43
|
+:Git [args] Run an arbitrary git command. Similar to :!git [args]
|
|
44
|
+ but chdir to the repository tree first.
|
|
45
|
+
|
|
46
|
+ *fugitive-:Gcd*
|
|
47
|
+:Gcd [directory] |:cd| relative to the repository.
|
|
48
|
+
|
|
49
|
+ *fugitive-:Glcd*
|
|
50
|
+:Glcd [directory] |:lcd| relative to the repository.
|
|
51
|
+
|
|
52
|
+ *fugitive-:Gstatus*
|
|
53
|
+:Gstatus Bring up the output of git-status in the preview
|
|
54
|
+ window. In addition to standard motions, you can
|
|
55
|
+ use <C-N> and <C-P> to jump from filename to
|
|
56
|
+ filename. Press C to invoke |:Gcommit|. Press D to
|
|
57
|
+ |:Gdiff| the file on the cursor line, or ds to
|
|
58
|
+ |:Gsdiff|. Press - to stage or unstage the file on
|
|
59
|
+ the cursor line. Press p to do so on a per hunk basis
|
|
60
|
+ (--patch). All of D, -, and p have a different,
|
|
61
|
+ sensible (and hopefully intuitive) behavior when
|
|
62
|
+ invoked on a heading rather than a file name.
|
|
63
|
+
|
|
64
|
+ *fugitive-:Gcommit*
|
|
65
|
+:Gcommit [args] A wrapper around git-commit. If there is nothing
|
|
66
|
+ to commit, |:Gstatus| is called instead. Unless the
|
|
67
|
+ arguments given would skip the invocation of an editor
|
|
68
|
+ (e.g., -m), a split window will be used to obtain a
|
|
69
|
+ commit message. Write and close that window (:wq or
|
|
70
|
+ |:Gwrite|) to finish the commit. Unlike when running
|
|
71
|
+ the actual git-commit command, it is possible (but
|
|
72
|
+ unadvisable) to muck with the index with commands like
|
|
73
|
+ git-add and git-reset while a commit message is
|
|
74
|
+ pending.
|
|
75
|
+
|
|
76
|
+ *fugitive-:Ggrep*
|
|
77
|
+:Ggrep [args] |:grep| with git-grep as 'grepprg'.
|
|
78
|
+
|
|
79
|
+ *fugitive-:Glog*
|
|
80
|
+:Glog [args] Load all previous revisions of the current file into
|
|
81
|
+ the quickfix list. Additional git-log arguments can
|
|
82
|
+ be given (for example, --reverse). If "--" appears as
|
|
83
|
+ an argument, no file specific filtering is done, and
|
|
84
|
+ commits are loaded into the quickfix list.
|
|
85
|
+
|
|
86
|
+ *fugitive-:Gedit* *fugitive-:Ge*
|
|
87
|
+:Gedit [revision] |:edit| a |fugitive-revision|.
|
|
88
|
+
|
|
89
|
+ *fugitive-:Gsplit*
|
|
90
|
+:Gsplit [revision] |:split| a |fugitive-revision|.
|
|
91
|
+
|
|
92
|
+ *fugitive-:Gvsplit*
|
|
93
|
+:Gvsplit [revision] |:vsplit| a |fugitive-revision|.
|
|
94
|
+
|
|
95
|
+ *fugitive-:Gtabedit*
|
|
96
|
+:Gtabedit [revision] |:tabedit| a |fugitive-revision|
|
|
97
|
+
|
|
98
|
+ *fugitive-:Gpedit*
|
|
99
|
+:Gpedit [revision] |:pedit| a |fugitive-revision|
|
|
100
|
+
|
|
101
|
+ *fugitive-:Gread*
|
|
102
|
+:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
|
|
103
|
+ When the argument is omitted, this is similar to
|
|
104
|
+ git-checkout on a work tree file or git-add on a stage
|
|
105
|
+ file, but without writing anything to disk.
|
|
106
|
+
|
|
107
|
+:{range}Gread [revision]
|
|
108
|
+ |:read| in a |fugitive-revision| after {range}.
|
|
109
|
+
|
|
110
|
+ *fugitive-:Gwrite*
|
|
111
|
+:Gwrite Write to the current file's path and stage the results.
|
|
112
|
+ When run in a work tree file, it is effectively git
|
|
113
|
+ add. Elsewhere, it is effectively git-checkout. A
|
|
114
|
+ great deal of effort is expended to behave sensibly
|
|
115
|
+ when the work tree or index version of the file is
|
|
116
|
+ open in another buffer.
|
|
117
|
+
|
|
118
|
+:Gwrite {path} You can give |:Gwrite| an explicit path of where in
|
|
119
|
+ the work tree to write. You can also give a path like
|
|
120
|
+ :0:foo.txt or even :0 to write to just that stage in
|
|
121
|
+ the index.
|
|
122
|
+
|
|
123
|
+ *fugitive-:Gwq*
|
|
124
|
+:Gwq [path] Like |:Gwrite| followed by |:quit| if the write
|
|
125
|
+ succeeded.
|
|
126
|
+
|
|
127
|
+:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
|
|
128
|
+ succeeded.
|
|
129
|
+
|
|
130
|
+ *fugitive-:Gdiff*
|
|
131
|
+:Gdiff [revision] Perform a |vimdiff| against the current file in the
|
|
132
|
+ given revision. With no argument, the version in the
|
|
133
|
+ index is used (which means a three-way diff during a
|
|
134
|
+ merge conflict, making it a git-mergetool
|
|
135
|
+ alternative). The newer of the two files is placed
|
|
136
|
+ to the right. Use |do| and |dp| and write to the
|
|
137
|
+ index file to simulate "git add --patch".
|
|
138
|
+
|
|
139
|
+ *fugitive-:Gsdiff*
|
|
140
|
+:Gsdiff [revision] Like |:Gdiff|, but split horizontally.
|
|
141
|
+
|
|
142
|
+ *fugitive-:Gvdiff*
|
|
143
|
+:Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|.
|
|
144
|
+
|
|
145
|
+ *fugitive-:Gmove*
|
|
146
|
+:Gmove {destination} Wrapper around git-mv that renames the buffer
|
|
147
|
+ afterward. The destination is relative to the current
|
|
148
|
+ directory except when started with a /, in which case
|
|
149
|
+ it is relative to the work tree. Add a ! to pass -f.
|
|
150
|
+
|
|
151
|
+ *fugitive-:Gremove*
|
|
152
|
+:Gremove Wrapper around git-rm that deletes the buffer
|
|
153
|
+ afterward. When invoked in an index file, --cached is
|
|
154
|
+ passed. Add a ! to pass -f and forcefully discard the
|
|
155
|
+ buffer.
|
|
156
|
+
|
|
157
|
+ *fugitive-:Gblame*
|
|
158
|
+:Gblame [flags] Run git-blame on the file and open the results in a
|
|
159
|
+ scroll bound vertical split. Press enter on a line to
|
|
160
|
+ reblame the file as it was in that commit. You can
|
|
161
|
+ give any of ltwfsMC as flags and they will be passed
|
|
162
|
+ along to git-blame.
|
|
163
|
+
|
|
164
|
+:[range]Gblame [flags] Run git-blame on the given range.
|
|
165
|
+
|
|
166
|
+ *fugitive-:Gbrowse*
|
|
167
|
+:[range]Gbrowse If the remote for the current branch is on GitHub,
|
|
168
|
+ open the current file, blob, tree, commit, or tag
|
|
169
|
+ (with git-web--browse) on GitHub. Otherwise, open the
|
|
170
|
+ current file, blob, tree, commit, or tag in
|
|
171
|
+ git-instaweb (if you have issues, verify you can run
|
|
172
|
+ "git instaweb" from a terminal). If a range is given,
|
|
173
|
+ it is appropriately appended to the URL as an anchor.
|
|
174
|
+
|
|
175
|
+:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
|
|
176
|
+ than opening it.
|
|
177
|
+
|
|
178
|
+:[range]Gbrowse {revision}
|
|
179
|
+ Like :Gbrowse, but for a given |fugitive-revision|. A
|
|
180
|
+ useful value here is -, which ties the URL to the
|
|
181
|
+ latest commit rather than a volatile branch.
|
|
182
|
+
|
|
183
|
+:[range]Gbrowse [...]@{remote}
|
|
184
|
+ Force using the given remote rather than the remote
|
|
185
|
+ for the current branch. The remote is used to
|
|
186
|
+ determine which GitHub repository to link to.
|
|
187
|
+
|
|
188
|
+MAPPINGS *fugitive-mappings*
|
|
189
|
+
|
|
190
|
+These maps are available in Git objects.
|
|
191
|
+
|
|
192
|
+ *fugitive-<CR>*
|
|
193
|
+<CR> Jump to the revision under the cursor.
|
|
194
|
+
|
|
195
|
+ *fugitive-o*
|
|
196
|
+o Jump to the revision under the cursor in a new split.
|
|
197
|
+
|
|
198
|
+ *fugitive-O*
|
|
199
|
+O Jump to the revision under the cursor in a new tab.
|
|
200
|
+
|
|
201
|
+ *fugitive-~*
|
|
202
|
+~ Go to the current file in the [count]th first
|
|
203
|
+ ancestor.
|
|
204
|
+
|
|
205
|
+ *fugitive-P*
|
|
206
|
+P Go to the current file in the [count]th parent.
|
|
207
|
+
|
|
208
|
+ *fugitive-C*
|
|
209
|
+C Go to the commit containing the current file.
|
|
210
|
+
|
|
211
|
+ *fugitive-a*
|
|
212
|
+a Show the current tag, commit, or tree in an alternate
|
|
213
|
+ format.
|
|
214
|
+
|
|
215
|
+SPECIFYING REVISIONS *fugitive-revision*
|
|
216
|
+
|
|
217
|
+Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING
|
|
218
|
+REVISIONS" section in the git-rev-parse man page. For commands that accept an
|
|
219
|
+optional revision, the default is the file in the index for work tree files
|
|
220
|
+and the work tree file for everything else. Example revisions follow.
|
|
221
|
+
|
|
222
|
+Revision Meaning ~
|
|
223
|
+HEAD .git/HEAD
|
|
224
|
+master .git/refs/heads/master
|
|
225
|
+HEAD^{} The commit referenced by HEAD
|
|
226
|
+HEAD^ The parent of the commit referenced by HEAD
|
|
227
|
+HEAD: The tree referenced by HEAD
|
|
228
|
+/HEAD The file named HEAD in the work tree
|
|
229
|
+Makefile The file named Makefile in the work tree
|
|
230
|
+HEAD^:Makefile The file named Makefile in the parent of HEAD
|
|
231
|
+:Makefile The file named Makefile in the index (writable)
|
|
232
|
+- The current file in HEAD
|
|
233
|
+^ The current file in the previous commit
|
|
234
|
+~3 The current file 3 commits ago
|
|
235
|
+: .git/index (Same as |:Gstatus|)
|
|
236
|
+:0 The current file in the index
|
|
237
|
+:1 The current file's common ancestor during a conflict
|
|
238
|
+:2 The current file in the target branch during a conflict
|
|
239
|
+:3 The current file in the merged branch during a conflict
|
|
240
|
+:/foo The most recent commit with "foo" in the message
|
|
241
|
+
|
|
242
|
+STATUSLINE *fugitive-statusline*
|
|
243
|
+
|
|
244
|
+ *fugitive#statusline()*
|
|
245
|
+Add %{fugitive#statusline()} to your statusline to get an indicator including
|
|
246
|
+the current branch and the currently edited file's commit. If you don't have
|
|
247
|
+a statusline, this one matches the default when 'ruler' is set:
|
|
248
|
+>
|
|
249
|
+ set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
|
|
250
|
+<
|
|
251
|
+ABOUT *fugitive-about*
|
|
252
|
+
|
|
253
|
+Grab the latest version or report a bug on GitHub:
|
|
254
|
+
|
|
255
|
+http://github.com/tpope/vim-fugitive
|
|
256
|
+
|
|
257
|
+ vim:tw=78:et:ft=help:norl:
|