aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/githooks.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-09 15:25:44 -0700
committerJunio C Hamano <gitster@pobox.com>2019-07-09 15:25:44 -0700
commitf496b064fc1135e0dded7f93d85d72eb0b302c22 (patch)
tree2149d0faf99c67ddd76a6d68125037f661db48a5 /Documentation/githooks.txt
parentb49d337bfbdd431697161244ff7b2241d9887c9f (diff)
parent97ed685701a6df0273f7d29fd5bc0a0658a63cad (diff)
downloadgit-f496b064fc1135e0dded7f93d85d72eb0b302c22.tar.gz
Merge branch 'nd/switch-and-restore'
Two new commands "git switch" and "git restore" are introduced to split "checking out a branch to work on advancing its history" and "checking out paths out of the index and/or a tree-ish to work on advancing the current history" out of the single "git checkout" command. * nd/switch-and-restore: (46 commits) completion: disable dwim on "git switch -d" switch: allow to switch in the middle of bisect t2027: use test_must_be_empty Declare both git-switch and git-restore experimental help: move git-diff and git-reset to different groups doc: promote "git restore" user-manual.txt: prefer 'merge --abort' over 'reset --hard' completion: support restore t: add tests for restore restore: support --patch restore: replace --force with --ignore-unmerged restore: default to --source=HEAD when only --staged is specified restore: reject invalid combinations with --staged restore: add --worktree and --staged checkout: factor out worktree checkout code restore: disable overlay mode by default restore: make pathspec mandatory restore: take tree-ish from --source option instead checkout: split part of it to new command 'restore' doc: promote "git switch" ...
Diffstat (limited to 'Documentation/githooks.txt')
-rw-r--r--Documentation/githooks.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 786e778ab8..82cd573776 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -165,12 +165,13 @@ rebased, and is not set when rebasing the current branch.
post-checkout
~~~~~~~~~~~~~
-This hook is invoked when a linkgit:git-checkout[1] is run after having updated the
+This hook is invoked when a linkgit:git-checkout[1] or
+linkgit:git-switch[1] is run after having updated the
worktree. The hook is given three parameters: the ref of the previous HEAD,
the ref of the new HEAD (which may or may not have changed), and a flag
indicating whether the checkout was a branch checkout (changing branches,
flag=1) or a file checkout (retrieving a file from the index, flag=0).
-This hook cannot affect the outcome of `git checkout`.
+This hook cannot affect the outcome of `git switch` or `git checkout`.
It is also run after linkgit:git-clone[1], unless the `--no-checkout` (`-n`) option is
used. The first parameter given to the hook is the null-ref, the second the
@@ -406,7 +407,8 @@ exit with a zero status.
For example, the hook can simply run `git read-tree -u -m HEAD "$1"`
in order to emulate `git fetch` that is run in the reverse direction
with `git push`, as the two-tree form of `git read-tree -u -m` is
-essentially the same as `git checkout` that switches branches while
+essentially the same as `git switch` or `git checkout`
+that switches branches while
keeping the local changes in the working tree that do not interfere
with the difference between the branches.