Autogenerated man pages for v1.3.3-ged90
[git.git] / man1 / git-receive-pack.1
1 .\"Generated by db2man.xsl. Don't modify this, modify the source.
2 .de Sh \" Subsection
3 .br
4 .if t .Sp
5 .ne 5
6 .PP
7 \fB\\$1\fR
8 .PP
9 ..
10 .de Sp \" Vertical space (when we can't use .PP)
11 .if t .sp .5v
12 .if n .sp
13 ..
14 .de Ip \" List item
15 .br
16 .ie \\n(.$>=3 .ne \\$3
17 .el .ne 3
18 .IP "\\$1" \\$2
19 ..
20 .TH "GIT-RECEIVE-PACK" 1 "" "" ""
21 .SH NAME
22 git-receive-pack \- Receive what is pushed into it
23 .SH "SYNOPSIS"
24
25
26 git\-receive\-pack <directory>
27
28 .SH "DESCRIPTION"
29
30
31 Invoked by git\-send\-pack and updates the repository with the information fed from the remote end\&.
32
33
34 This command is usually not invoked directly by the end user\&. The UI for the protocol is on the git\-send\-pack side, and the program pair is meant to be used to push updates to remote repository\&. For pull operations, see git\-fetch\-pack and git\-clone\-pack\&.
35
36
37 The command allows for creation and fast forwarding of sha1 refs (heads/tags) on the remote end (strictly speaking, it is the local end receive\-pack runs, but to the user who is sitting at the send\-pack end, it is updating the remote\&. Confused?)
38
39
40 Before each ref is updated, if $GIT_DIR/hooks/update file exists and executable, it is called with three parameters:
41
42 .nf
43 $GIT_DIR/hooks/update refname sha1\-old sha1\-new
44 .fi
45
46
47 The refname parameter is relative to $GIT_DIR; e\&.g\&. for the master head this is "refs/heads/master"\&. Two sha1 are the object names for the refname before and after the update\&. Note that the hook is called before the refname is updated, so either should match what is recorded in refname\&.
48
49
50 The hook should exit with non\-zero status if it wants to disallow updating the named ref\&. Otherwise it should exit with zero\&.
51
52
53 Using this hook, it is easy to generate mails on updates to the local repository\&. This example script sends a mail with the commits pushed to the repository:
54
55 .nf
56 #!/bin/sh
57 # mail out commit update information\&.
58 if expr "$2" : '0*$' >/dev/null
59 then
60         echo "Created a new ref, with the following commits:"
61         git\-rev\-list \-\-pretty "$2"
62 else
63         echo "New commits:"
64         git\-rev\-list \-\-pretty "$3" "^$2"
65 fi |
66 mail \-s "Changes to ref $1" commit\-list@mydomain
67 exit 0
68 .fi
69
70
71 Another hook $GIT_DIR/hooks/post\-update, if exists and executable, is called with the list of refs that have been updated\&. This can be used to implement repository wide cleanup task if needed\&. The exit code from this hook invocation is ignored; the only thing left for git\-receive\-pack to do at that point is to exit itself anyway\&. This hook can be used, for example, to run "git\-update\-server\-info" if the repository is packed and is served via a dumb transport\&.
72
73 .nf
74 #!/bin/sh
75 exec git\-update\-server\-info
76 .fi
77
78
79 There are other real\-world examples of using update and post\-update hooks found in the Documentation/howto directory\&.
80
81 .SH "OPTIONS"
82
83 .TP
84 <directory>
85 The repository to sync into\&.
86
87 .SH "SEE ALSO"
88
89
90 \fBgit\-send\-pack\fR(1)
91
92 .SH "AUTHOR"
93
94
95 Written by Linus Torvalds <torvalds@osdl\&.org>
96
97 .SH "DOCUMENTATION"
98
99
100 Documentation by Junio C Hamano\&.
101
102 .SH "GIT"
103
104
105 Part of the \fBgit\fR(7) suite
106