Skip to content

Commit

Permalink
Merge branch 'vh/config-interactive-singlekey-doc' into maint
Browse files Browse the repository at this point in the history
* vh/config-interactive-singlekey-doc:
  git-reset.txt: better docs for '--patch'
  git-checkout.txt: better docs for '--patch'
  git-stash.txt: better docs for '--patch'
  git-add.txt: document 'interactive.singlekey'
  config.txt: 'interactive.singlekey; is used by...
  • Loading branch information
Junio C Hamano committed May 31, 2011
2 parents 82ca090 + 6086ff6 commit 398dbe5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
5 changes: 3 additions & 2 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,9 @@ instaweb.port::
interactive.singlekey::
In interactive commands, allow the user to provide one-letter
input with a single key (i.e., without hitting enter).
Currently this is used only by the `\--patch` mode of
linkgit:git-add[1]. Note that this setting is silently
Currently this is used by the `\--patch` mode of
linkgit:git-add[1], linkgit:git-reset[1], linkgit:git-stash[1] and
linkgit:git-checkout[1]. Note that this setting is silently
ignored if portable keystroke input is not available.

log.date::
Expand Down
6 changes: 5 additions & 1 deletion Documentation/git-add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ patch::
This lets you choose one path out of a 'status' like selection.
After choosing the path, it presents the diff between the index
and the working tree file and asks you if you want to stage
the change of each hunk. You can say:
the change of each hunk. You can select one of the following
options and type return:

y - stage this hunk
n - do not stage this hunk
Expand All @@ -293,6 +294,9 @@ patch::
+
After deciding the fate for all hunks, if there is any hunk
that was chosen, the index is updated with the selected hunks.
+
You can omit having to type return here, by setting the configuration
variable `interactive.singlekey` to `true`.

diff::

Expand Down
7 changes: 4 additions & 3 deletions Documentation/git-checkout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SYNOPSIS
'git checkout' [-q] [-f] [-m] [--detach] [<commit>]
'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
'git checkout' --patch [<tree-ish>] [--] [<paths>...]
'git checkout' [-p|--patch] [<tree-ish>] [--] [<paths>...]

DESCRIPTION
-----------
Expand Down Expand Up @@ -45,7 +45,7 @@ $ git checkout <branch>
that is to say, the branch is not reset/created unless "git checkout" is
successful.

'git checkout' [--patch] [<tree-ish>] [--] <pathspec>...::
'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::

When <paths> or `--patch` are given, 'git checkout' does *not*
switch branches. It updates the named paths in the working tree
Expand Down Expand Up @@ -183,7 +183,8 @@ the conflicted merge in the specified paths.
working tree (and if a <tree-ish> was specified, the index).
+
This means that you can use `git checkout -p` to selectively discard
edits from your current working tree.
edits from your current working tree. See the ``Interactive Mode''
section of linkgit:git-add[1] to learn how to operate the `\--patch` mode.

<branch>::
Branch to checkout; if it refers to a branch (i.e., a name that,
Expand Down
7 changes: 4 additions & 3 deletions Documentation/git-reset.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git reset' [-q] [<commit>] [--] <paths>...
'git reset' --patch [<commit>] [--] [<paths>...]
'git reset' [--patch|-p] [<commit>] [--] [<paths>...]
'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]

DESCRIPTION
Expand Down Expand Up @@ -39,8 +39,9 @@ working tree in one go.
and <commit> (defaults to HEAD). The chosen hunks are applied
in reverse to the index.
+
This means that `git reset -p` is the opposite of `git add -p` (see
linkgit:git-add[1]).
This means that `git reset -p` is the opposite of `git add -p`, i.e.
you can use it to selectively reset hunks. See the ``Interactive Mode''
section of linkgit:git-add[1] to learn how to operate the `\--patch` mode.

'git reset' [--<mode>] [<commit>]::
This form resets the current branch head to <commit> and
Expand Down
9 changes: 5 additions & 4 deletions Documentation/git-stash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SYNOPSIS
'git stash' drop [-q|--quiet] [<stash>]
'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
'git stash' branch <branchname> [<stash>]
'git stash' [save [--patch] [-k|--[no-]keep-index] [-q|--quiet] [<message>]]
'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet] [<message>]]
'git stash' clear
'git stash' create

Expand Down Expand Up @@ -42,7 +42,7 @@ is also possible).
OPTIONS
-------

save [--patch] [--[no-]keep-index] [-q|--quiet] [<message>]::
save [-p|--patch] [--[no-]keep-index] [-q|--quiet] [<message>]::

Save your local modifications to a new 'stash', and run `git reset
--hard` to revert them. The <message> part is optional and gives
Expand All @@ -54,12 +54,13 @@ save [--patch] [--[no-]keep-index] [-q|--quiet] [<message>]::
If the `--keep-index` option is used, all changes already added to the
index are left intact.
+
With `--patch`, you can interactively select hunks from in the diff
With `--patch`, you can interactively select hunks from the diff
between HEAD and the working tree to be stashed. The stash entry is
constructed such that its index state is the same as the index state
of your repository, and its worktree contains only the changes you
selected interactively. The selected changes are then rolled back
from your worktree.
from your worktree. See the ``Interactive Mode'' section of
linkgit:git-add[1] to learn how to operate the `\--patch` mode.
+
The `--patch` option implies `--keep-index`. You can use
`--no-keep-index` to override this.
Expand Down

0 comments on commit 398dbe5

Please sign in to comment.