I would like to know how git-receive-pack works, because I have quite literally no idea what happens with it. Can anyone shed some light on this mystery?
Description. Invoked by git fetch-pack, learns what objects the other side is missing, and sends them after packing. This command is usually not invoked directly by the end user.
The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.
Git can use four distinct protocols to transfer data: Local, HTTP, Secure Shell (SSH) and Git. Here we'll discuss what they are and in what basic circumstances you would want (or not want) to use them.
According to the man page:
http://schacon.github.com/git/git-receive-pack.html
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(1).
The command allows for creation and fast-forwarding of sha1 refs (heads/tags) on the remote end (strictly speaking, it is the local end git-receive-pack runs, but to the user who is sitting at the send-pack end, it is updating the remote. Confused?)
Even the person writing the man page thinks it's confusing, so don't blame yourself it you don't understand it!
Basically, this is part of the code that receives commits on the remote server that were packed up and sent by send-pack
on your local machine when you do a git push
.
It's not important to understand the specifics behind it -- as the docs say, it's not a command you should ever actually type.
If you're really deeply interested in how it works internally, a couple of good places to start might be:
The Wikipedia Page on Git (Software), The Git Website itself, or The free book, Pro Git
Or, you can always go look the 'c' code up for that command in the source code right here on github.
http://git-scm.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With