Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between git pull . master vs git merge master

Tags:

Having no remote repository, just one local repository with two branches.

$ git branch -a   master * devel 

Are following commands in this context the same/synonym?

$ git pull . master 

and

$ git merge master 

UPDATE:

$ git help pull gives following information

SYNOPSIS    git pull <options> <repository> <refspec>...  DESCRIPTION    ...    Note that you can use . (current directory) as the <repository> to pull    from the local repository — this is useful when merging local branches    into the current branch. 

I actually don't understand why this is useful as mentioned in this manpage.

like image 738
Hotschke Avatar asked Jun 27 '13 09:06

Hotschke


People also ask

What is difference between git pull and git merge?

The git pull command first runs git fetch which downloads content from the specified remote repository. Then a git merge is executed to merge the remote content refs and heads into a new local merge commit.

What does git pull master do?

'git pull origin master' will fetch and update only a specific branch called master and origin in the remote repository. Often, the default branch in Git is a master branch, and it keeps updating frequently. A user can use any branch name to pull that branch from the remote.

What's the difference between git pull and git pull origin master?

Remember, a pull is a fetch and a merge. git pull origin master fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.


1 Answers

pull is a combination command, fetch followed by merge. With default or sensible params it will synchronize your current branch.

With the params as in question most of its work is sabotaged. the fetch part is overruled to use the current repo, so that is skipped, and you explicitly ask master overruling FETCH_HEAD.

So in that form I believe they are identical (and I'd put the first in nonsense category too).

like image 119
Balog Pal Avatar answered Sep 18 '22 10:09

Balog Pal