开发者

What am I Fetching with git fetch?

Context: I've been using git for about 6 months and I'm comfortable with it on a surface level. However, some of what I'm doing is still black box voodoo that I'd like to understand better.

When I run something like

git fetch upstream
git merge upstream/master

I understand this is the equivalent of a pull. First a fetch something, then I use that something to perform the merge.

What I don't开发者_运维问答 understand is what IS it I'm fetching, and where does this information live? I understand conceptually I'm fetching all the branches on the upstream remote repository, but it seems like that information would need to live somewhere, and that's where my brain and understanding of git can only come up with "What am I Fetching with git Fetch?"


You're fetching commit objects which represent the incoming changes, into your local copy of the repository. The actual data is stored under the .git directory, until you git-merge, at which point it will also be represented in the working directory.


Want to know all the gory details? Check out Pro Git, Chapter 9: Git Internals.


The information from fetch is stuffed in .git folder, as if it was another branch. The local repository holds information about commits of all branches, including the branches that are fetched from remote repositories.


You're fetching git objects, stored in .git/objects directory, and the information about remote head object (.git/FETCH_HEAD).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜