summaryrefslogtreecommitdiffstats
path: root/githooks.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-09 19:54:04 -0700
committerJunio C Hamano <gitster@pobox.com>2019-07-09 19:54:04 -0700
commitc9f11c2b3a739e3e249b9e7711bf1ed76ef3c6db (patch)
tree06ddfc72dff8e370e395a3acc692c8ab48147227 /githooks.txt
parentd0a9940c76b71c9df840a098a423d3400779d83c (diff)
downloadgit-htmldocs-c9f11c2b3a739e3e249b9e7711bf1ed76ef3c6db.tar.gz
Autogenerated HTML docs for v2.22.0-428-g6d5b2
Diffstat (limited to 'githooks.txt')
-rw-r--r--githooks.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/githooks.txt b/githooks.txt
index 786e778ab..82cd57377 100644
--- a/githooks.txt
+++ b/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.