Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default behaviour of 'git pull'

Tags:

git

git-pull

Why is that git pull pulls everything including newly created remote branches but git pull origin master does not?

I'm using git version 2.9.3.windows.2.

like image 303
Thaadikkaaran Avatar asked Nov 22 '16 10:11

Thaadikkaaran


People also ask

What is default branch for git pull?

About the default branch The default branch is also the initial branch that Git checks out locally when someone clones the repository. Unless you specify a different branch, the default branch in a repository is the base branch for new pull requests and code commits.

What does git fetch do by default?

The git fetch command downloads commits, files, and refs from a remote repository into your local repo. Fetching is what you do when you want to see what everybody else has been working on.

What is git pull strategy?

Then " git pull " will fetch and replay the changes from the remote master branch since it diverged from the local master (i.e., E ) until its current commit ( C ) on top of master and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes ...

Is git fetch and git pull command have the same behavior?

git fetch is similar to pull but doesn't merge. i.e. it fetches remote updates ( refs and objects ) but your local stays the same (i.e. origin/master gets updated but master stays the same) .


1 Answers

In Layman Language, git pull fetches everything from your remote (all new branches and updates old branches) and by default, it will do so for origin. If you have any other remote like upstream you have to specify that like git pull upstream and it will update everything from upstream.

like image 130
R. Gurung Avatar answered Nov 06 '22 15:11

R. Gurung