shortlog: fix segfault on empty authorname
[git/dscho.git] / Documentation / git-receive-pack.txt
blob0dfadc2a32a44ef1e026ae95c8cc5906ec4d4d5c
1 git-receive-pack(1)
2 ===================
4 NAME
5 ----
6 git-receive-pack - Receive what is pushed into it
9 SYNOPSIS
10 --------
11 'git-receive-pack' <directory>
13 DESCRIPTION
14 -----------
15 Invoked by 'git-send-pack' and updates the repository with the
16 information fed from the remote end.
18 This command is usually not invoked directly by the end user.
19 The UI for the protocol is on the 'git-send-pack' side, and the
20 program pair is meant to be used to push updates to remote
21 repository.  For pull operations, see 'git-fetch-pack'.
23 The command allows for creation and fast forwarding of sha1 refs
24 (heads/tags) on the remote end (strictly speaking, it is the
25 local end receive-pack runs, but to the user who is sitting at
26 the send-pack end, it is updating the remote.  Confused?)
28 Before each ref is updated, if $GIT_DIR/hooks/update file exists
29 and executable, it is called with three parameters:
31        $GIT_DIR/hooks/update refname sha1-old sha1-new
33 The refname parameter is relative to $GIT_DIR; e.g. for the
34 master head this is "refs/heads/master".  Two sha1 are the
35 object names for the refname before and after the update.  Note
36 that the hook is called before the refname is updated, so either
37 sha1-old is 0{40} (meaning there is no such ref yet), or it
38 should match what is recorded in refname.
40 The hook should exit with non-zero status if it wants to
41 disallow updating the named ref.  Otherwise it should exit with
42 zero.
44 Using this hook, it is easy to generate mails on updates to
45 the local repository. This example script sends a mail with
46 the commits pushed to the repository:
48         #!/bin/sh
49         # mail out commit update information.
50         if expr "$2" : '0*$' >/dev/null
51         then
52                 echo "Created a new ref, with the following commits:"
53                 git-rev-list --pretty "$2"
54         else
55                 echo "New commits:"
56                 git-rev-list --pretty "$3" "^$2"
57         fi |
58         mail -s "Changes to ref $1" commit-list@mydomain
59         exit 0
61 Another hook $GIT_DIR/hooks/post-update, if exists and
62 executable, is called with the list of refs that have been
63 updated.  This can be used to implement repository wide cleanup
64 task if needed.  The exit code from this hook invocation is
65 ignored; the only thing left for git-receive-pack to do at that
66 point is to exit itself anyway.  This hook can be used, for
67 example, to run "git-update-server-info" if the repository is
68 packed and is served via a dumb transport.
70         #!/bin/sh
71         exec git-update-server-info
73 There are other real-world examples of using update and
74 post-update hooks found in the Documentation/howto directory.
76 git-receive-pack honours the receive.denyNonFastforwards flag, which
77 tells it if updates to a ref should be denied if they are not fast-forwards.
79 OPTIONS
80 -------
81 <directory>::
82         The repository to sync into.
85 SEE ALSO
86 --------
87 gitlink:git-send-pack[1]
90 Author
91 ------
92 Written by Linus Torvalds <torvalds@osdl.org>
94 Documentation
95 --------------
96 Documentation by Junio C Hamano.
98 GIT
99 ---
100 Part of the gitlink:git[7] suite