Git Pull

satya - 10/23/2019, 1:33:41 PM

Git Pull reference document

Git Pull reference document

satya - 10/23/2019, 1:42:58 PM

Quick summary

Incorporates changes from a remote repository into the current branch.

In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

git pull [<options>] [<repository> [<refspec>??]]

satya - 10/23/2019, 1:48:02 PM

Consider this from there


    A---B---C master on origin (remote)
    /
D---E---F---G master (local)
    ^
    origin/master in your repository (local)

satya - 10/23/2019, 1:50:18 PM

Now if you pull

The commits on the master branche (code) from the remote server called origin (A, B, C) are downloaded first

They are replayed on latest commit (G) on the local master branch and the local master branch will have a new commit called H as below

satya - 10/23/2019, 1:50:56 PM

The result locally


          A---B---C origin/master
	 /             D---E---F---G---H master

satya - 10/23/2019, 1:51:21 PM

H is called a merge commit

H is called a merge commit

satya - 10/23/2019, 1:51:46 PM

where as F and G are explicitly named locally

where as F and G are explicitly named locally

satya - 10/23/2019, 1:53:28 PM

An example command may look like


git pull origin master

satya - 10/23/2019, 1:55:45 PM

Meaning...

fetch code from the branch master from a server called origin

Merge that code with the "current" local branch. (it doesn't say these have to be tracked).

So i assume the current branch doesn't have to be "master"!!!