diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-12-01 15:29:54 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-01-08 14:28:43 -0800 |
commit | 0855331941b723b227e93b33955bbe0b45025659 (patch) | |
tree | 70c84e087db0451e9b439c094c809b33fc268535 /Documentation/config.txt | |
parent | 21b138d0f64d99b55e901f90d4211e036b881e64 (diff) | |
download | git-0855331941b723b227e93b33955bbe0b45025659.tar.gz git-0855331941b723b227e93b33955bbe0b45025659.tar.xz |
receive-pack: support push-to-checkout hook
When receive.denyCurrentBranch is set to updateInstead, a push that
tries to update the branch that is currently checked out is accepted
only when the index and the working tree exactly matches the
currently checked out commit, in which case the index and the
working tree are updated to match the pushed commit. Otherwise the
push is refused.
This hook can be used to customize this "push-to-deploy" logic. The
hook receives the commit with which the tip of the current branch is
going to be updated, and can decide what kind of local changes are
acceptable and how to update the index and the working tree to match
the updated tip of the current branch.
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 `read-tree -u -m` is
essentially the same as `git checkout` that switches branches while
keeping the local changes in the working tree that do not interfere
with the difference between the branches.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/config.txt')
-rw-r--r-- | Documentation/config.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index 6a4c19e77..4e558abc7 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2131,11 +2131,15 @@ receive.denyCurrentBranch:: message. Defaults to "refuse". + Another option is "updateInstead" which will update the working -directory (must be clean) if pushing into the current branch. This option is +tree if pushing into the current branch. This option is intended for synchronizing working directories when one side is not easily accessible via interactive ssh (e.g. a live web site, hence the requirement that the working directory be clean). This mode also comes in handy when developing inside a VM to test and fix code on different Operating Systems. ++ +By default, "updateInstead" will refuse the push if the working tree or +the index have any difference from the HEAD, but the `push-to-checkout` +hook can be used to customize this. See linkgit:githooks[5]. receive.denyNonFastForwards:: If set to true, git-receive-pack will deny a ref update which is |