Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the output of git pull actually mean?

Tags:

git

I'm trying to gain a more thorough understanding of git.

Can someone give me a simple line-by-line explanation of what basic git pull output means? Example:

remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 2), reused 0 (delta 0) Unpacking objects: 100% (7/7), done. From ssh://my.remote.host.com/~/git/myproject  * branch            master     -> FETCH_HEAD Updating 9d447d2..f74fb21 Fast forward  app/controllers/myproject_controller.rb |   13 +++++++++++++  1 files changed, 13 insertions(+), 0 deletions(-) 
like image 865
slabserif23 Avatar asked Jul 27 '10 00:07

slabserif23


People also ask

What is git pull output?

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.

Does git pull pull everything?

The git pull command first runs a git fetch command to check for changes. The fetch operation returns the metadata for our commits . Then, the git pull command retrieves all the changes we have made to our remote repository and changes our local files.

What happens when you run a git pull command?

The "git pull" command. The pull command is used to access the changes (commits)from a remote repository to the local repository. It updates the local branches with the remote-tracking branches. Remote tracking branches are branches that have been set up to push and pull from the remote repository.

What does it mean to pull from GitHub?

Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.


1 Answers

Under the hood, git pull is git fetch followed by git merge. Here's the fetch portion:

remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 2), reused 0 (delta 0) 

At this point, you've told the remote what you want. It finds all the objects it needs to give you (counting them in the process, I believe), compresses them for faster transfer over the network, and then reports what it's sending you. Objects may be blobs, trees, commits, or tags - see for example the git book for more information.

Unpacking objects: 100% (7/7), done. 

You receive the pack (set of compressed objects) and unpack it.

From ssh://my.remote.host.com/~/git/myproject  * branch            master     -> FETCH_HEAD 

You've fetched the branch 'master' from the given remote; the ref FETCH_HEAD now points to it. Now we move on to the merge - precisely, git will merge FETCH_HEAD (the remote's master branch) into your current branch (presumably master).

Updating 9d447d2..f74fb21 Fast forward 

It turns out that you haven't diverged from the remote's master branch, so the merge is a fast-forward (a trivial merge where it simply moves you forward in the history). Git notes the original position of your master branch (9d447d2) and the new position (f74fb21) it's been fast-forwarded to. If you had diverged from the remote's master branch, you'd see the output of a recursive merge here - Merge made by recursive, possibly along with some Auto-merged <file> and (oh no!) merge conflicts!

 app/controllers/myproject_controller.rb |   13 +++++++++++++  1 files changed, 13 insertions(+), 0 deletions(-) 

Finally, it shows you the diffstat between the original and post-merge position of your master branch; this is basically what you'd get from git diff --stat master@{1} master.

like image 148
Cascabel Avatar answered Sep 23 '22 18:09

Cascabel