what is Github doing when I click on these buttons? Let's say I do a pull request in Github. What is the git command I would type in (git pull ....
?). And how about forking? What is Github doing behind the scenes.
There is no git fork command. From the command line you can clone a Git repo, you can pull from a Git repo and you can fetch updates from a Git repo, but there is no git fork command if you're working with a standard Git installation.
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.
A fork can be thought of as equivalent to git clone <URL for source repo>
although the repo on GitHub is bare (no working tree "checked out" files) so behind the scenes they might be doing something like git clone --bare <URL>
.
A pull request is asking the owner of the source repo to pull your changes in to their repo ... so there isn't an equivalent git command. It's a bit like emailing the owner of that repo to say "here are some changes I've made, hope you like them". If they accept the pull request they would, basically, then do the equivalent of git pull <URL for your repo>
.
If you are wondering how emulate the behavior of forking and pull requests, VonC has answered that far better than I can here. Basically clone
and pull
.
If you are interested in what GitHub is actually doing behind the scenes, its a little more complicated. Zach Holman, @holman on GitHub, recently gave a talk "How To Build A GitHub" where he goes into detail about their implementation.
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