git pull and merge code example

Example 1: difference between git pull and git merge

// If you want to bring your local repository up to speed with a 
// remote repository use below command. It is the same as 
// (git fetch + git merge)
git pull

// The below command is going to import commits from a remote repo 
// without merging them, which gives you the opportunity to review 
// them before integrating.
git fetch

Example 2: how a to pull a branch in git

$ git pull origin other-branch

Example 3: how to git pull origin master

git pull origin

Example 4: what is git pull rebase

The content of your work tree should end up the same in both cases; you've just created a different history leading up to it.

Tags:

Misc Example