Reputation: 11128
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?
Upvotes: 28
Views: 54846
Reputation: 890
Accepted answer will also pulls master into your actual branch.
git fetch
git branch -D master
git checkout --track origin/master
Upvotes: 0
Reputation: 18402
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/master
is 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.
Upvotes: 44