What happens when I do a git pull origin master in a development branch?

Let's say I have a private thread branch called develop with 2 commits in front of the wizard.

What does git pull origin master do?

Pull everything from the remote wizard to local development and combine it? Pull everything in the local branch of the wizard and merge it?

And is there a way to update the master from development without git checkout master ?

+43
git pull
Jan 05 '12 at 17:12
source share
2 answers

git pull origin master pulls the git pull origin master branch from the remote called origin to your current branch. This affects only your current branch, not the local branch of the wizard.

This will give you a story that looks something like this:

 - x - x - x - x (develop) \ / x - x - x (origin/master) 

The local branch of the master does not matter in this. git pull is essentially a combination of git fetch and git merge ; it fetches the remote branch, then merges it into your current branch. This is a merger, like any other; he does nothing magic.

If you want to update the local branch of the wizard, you have no choice but to check this. It is not possible to merge into a branch that has not been verified, because a Git merge requires a work tree. (In particular, it is absolutely necessary to report merger conflicts and to resolve them.)

If you know that dragging to the wizard will be fast forward (i.e. you do not have commits in your local branch of the wizard that are not at the initial level), you can do as described in this answer .

+68
Jan 05 2018-12-18T00:
source share

Once you commit the changes to your branch with

 git add -A git commit -m <message> 

Then you can:

 git pull origin master 

to your branch, and this will cause your commits to be exceeded. Your branch will now even be with the master + your commits on top. So now you can:

 git push 

and git will push your changes together with the master, will introduce a branch in you. You can easily combine this into a master on Github.

+3
Oct. 14 '16 at 16:58
source share



All Articles