|
|
@ -92,9 +92,11 @@ See ``Interactive mode'' for details. |
|
|
|
edit it. After the editor was closed, adjust the hunk headers |
|
|
|
edit it. After the editor was closed, adjust the hunk headers |
|
|
|
and apply the patch to the index. |
|
|
|
and apply the patch to the index. |
|
|
|
+ |
|
|
|
+ |
|
|
|
*NOTE*: Obviously, if you change anything else than the first character |
|
|
|
The intent of this option is to pick and choose lines of the patch to |
|
|
|
on lines beginning with a space or a minus, the patch will no longer |
|
|
|
apply, or even to modify the contents of lines to be staged. This can be |
|
|
|
apply. |
|
|
|
quicker and more flexible than using the interactive hunk selector. |
|
|
|
|
|
|
|
However, it is easy to confuse oneself and create a patch that does not |
|
|
|
|
|
|
|
apply to the index. See EDITING PATCHES below. |
|
|
|
|
|
|
|
|
|
|
|
-u:: |
|
|
|
-u:: |
|
|
|
--update:: |
|
|
|
--update:: |
|
|
@ -295,6 +297,78 @@ diff:: |
|
|
|
This lets you review what will be committed (i.e. between |
|
|
|
This lets you review what will be committed (i.e. between |
|
|
|
HEAD and index). |
|
|
|
HEAD and index). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EDITING PATCHES |
|
|
|
|
|
|
|
--------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Invoking `git add -e` or selecting `e` from the interactive hunk |
|
|
|
|
|
|
|
selector will open a patch in your editor; after the editor exits, the |
|
|
|
|
|
|
|
result is applied to the index. You are free to make arbitrary changes |
|
|
|
|
|
|
|
to the patch, but note that some changes may have confusing results, or |
|
|
|
|
|
|
|
even result in a patch that cannot be applied. If you want to abort the |
|
|
|
|
|
|
|
operation entirely (i.e., stage nothing new in the index), simply delete |
|
|
|
|
|
|
|
all lines of the patch. The list below describes some common things you |
|
|
|
|
|
|
|
may see in a patch, and which editing operations make sense on them. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- |
|
|
|
|
|
|
|
added content:: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Added content is represented by lines beginning with "{plus}". You can |
|
|
|
|
|
|
|
prevent staging any addition lines by deleting them. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removed content:: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Removed content is represented by lines beginning with "-". You can |
|
|
|
|
|
|
|
prevent staging their removal by converting the "-" to a " " (space). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modified content:: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Modified content is represented by "-" lines (removing the old content) |
|
|
|
|
|
|
|
followed by "{plus}" lines (adding the replacement content). You can |
|
|
|
|
|
|
|
prevent staging the modification by converting "-" lines to " ", and |
|
|
|
|
|
|
|
removing "{plus}" lines. Beware that modifying only half of the pair is |
|
|
|
|
|
|
|
likely to introduce confusing changes to the index. |
|
|
|
|
|
|
|
-- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are also more complex operations that can be performed. But beware |
|
|
|
|
|
|
|
that because the patch is applied only to the index and not the working |
|
|
|
|
|
|
|
tree, the working tree will appear to "undo" the change in the index. |
|
|
|
|
|
|
|
For example, introducing a a new line into the index that is in neither |
|
|
|
|
|
|
|
the HEAD nor the working tree will stage the new line for commit, but |
|
|
|
|
|
|
|
the line will appear to be reverted in the working tree. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Avoid using these constructs, or do so with extreme caution. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- |
|
|
|
|
|
|
|
removing untouched content:: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Content which does not differ between the index and working tree may be |
|
|
|
|
|
|
|
shown on context lines, beginning with a " " (space). You can stage |
|
|
|
|
|
|
|
context lines for removal by converting the space to a "-". The |
|
|
|
|
|
|
|
resulting working tree file will appear to re-add the content. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modifying existing content:: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
One can also modify context lines by staging them for removal (by |
|
|
|
|
|
|
|
converting " " to "-") and adding a "{plus}" line with the new content. |
|
|
|
|
|
|
|
Similarly, one can modify "{plus}" lines for existing additions or |
|
|
|
|
|
|
|
modifications. In all cases, the new modification will appear reverted |
|
|
|
|
|
|
|
in the working tree. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new content:: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You may also add new content that does not exist in the patch; simply |
|
|
|
|
|
|
|
add new lines, each starting with "{plus}". The addition will appear |
|
|
|
|
|
|
|
reverted in the working tree. |
|
|
|
|
|
|
|
-- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are also several operations which should be avoided entirely, as |
|
|
|
|
|
|
|
they will make the patch impossible to apply: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* adding context (" ") or removal ("-") lines |
|
|
|
|
|
|
|
* deleting context or removal lines |
|
|
|
|
|
|
|
* modifying the contents of context or removal lines |
|
|
|
|
|
|
|
|
|
|
|
SEE ALSO |
|
|
|
SEE ALSO |
|
|
|
-------- |
|
|
|
-------- |
|
|
|
linkgit:git-status[1] |
|
|
|
linkgit:git-status[1] |
|
|
|