1git-receive-pack(1) 2=================== 3v0.1, July 2005 4 5NAME 6---- 7git-receive-pack - Receive what is pushed into it 8 9 10SYNOPSIS 11-------- 12'git-receive-pack' <directory> 13 14DESCRIPTION 15----------- 16Invoked by 'git-send-pack' and updates the repository with the 17information fed from the remote end. 18 19This command is usually not invoked directly by the end user. 20The UI for the protocol is on the 'git-send-pack' side, and the 21program pair is meant to be used to push updates to remote 22repository. For pull operations, see 'git-fetch-pack' and 23'git-clone-pack'. 24 25The command allows for creation and fast forwarding of sha1 refs 26(heads/tags) on the remote end (strictly speaking, it is the 27local end receive-pack runs, but to the user who is sitting at 28the send-pack end, it is updating the remote. Confused?) 29 30Before each ref is updated, if $GIT_DIR/hooks/update file exists 31and executable, it is called with three parameters: 32 33 $GIT_DIR/hooks/update refname sha1-old sha1-new 34 35The refname parameter is relative to $GIT_DIR; e.g. for the 36master head this is "refs/heads/master". Two sha1 are the 37object names for the refname before and after the update. Note 38that the hook is called before the refname is updated, so either 39sha1-old is 0{40} (meaning there is no such ref yet), or it 40should match what is recorded in refname. 41 42The hook should exit with non-zero status if it wants to 43disallow updating the named ref. Otherwise it should exit with 44zero. 45 46The same hook is also called with an empty string as refname and 47no other arguments just before git-receive-pack exits. This can 48be used to implement repository wide cleanup task if needed. 49The exit code from this hook invocation is ignored; the only 50thing left for git-receive-pack to do at that point is to exit 51itself anyway. 52 53Using this hook, it is easy to generate mails on updates to 54the local repository. This example script sends a mail with 55the commits pushed to the repository: 56 57 #!/bin/sh 58 case "$#,$1" in 59 1,) # help packed repository pulled via dumb protocol. 60 git-update-server-info 61 ;; 62 *) # mail out commit update information. 63 if expr "$2" : '0*$' >/dev/null 64 then 65 echo "Created now ref." 66 git-rev-list --pretty "$2" 67 else 68 echo "New commits" 69 git-rev-list --pretty "$3" "^$2" 70 fi | 71 mail -s "Changes to ref $1" commit-list@mydomain 72 esac 73 exit 0 74 75OPTIONS 76------- 77<directory>:: 78 The repository to sync into. 79 80Author 81------ 82Written by Linus Torvalds <torvalds@osdl.org> 83 84Documentation 85-------------- 86Documentation by Junio C Hamano. 87 88GIT 89--- 90Part of the link:git.html[git] suite