Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pull origin/master branch to local/master, when in local/develop

Tags:

I work in develop branch. Sometimes, when I want to push changes to origin, git say, that there are some changes in origin/master branch.

How to pull changes from remote master to local master without checkout to local master?

like image 678
nkuhta Avatar asked May 15 '13 08:05

nkuhta


People also ask

How do I pull a git origin master?

In case you are using the Tower Git client, pulling from a remote is very easy: simply drag the remote branch and drop it onto your current HEAD in the sidebar - or click the "Pull" button in the toolbar.

How do I move origin master to local branch?

git pull origin master will pull changes from the origin remote, master branch and merge them to the local checked-out branch. git pull origin/master will pull changes from the locally stored branch origin/master and merge that to the local checked-out branch.


1 Answers

If you want to update your local master without checkout, you can do :

git pull origin master:master 

That will update your local master with the origin/master

Or, as I assume that you want to ultimately rebase your develop branch with the changes occured in origin/master, you can do a simple git fetch, that will not touch your local branches :

git fetch 

Now your origin/masteris up to date, so you can rebase or merge your local branch with these changes. For example, when you are in your develop branch :

git rebase origin/master 

And your develop branch will be up to date with the changes.

like image 104
cexbrayat Avatar answered Oct 27 '22 15:10

cexbrayat