I am working on a 3 branch project.
I am on branch1, and there is master branch.
When I need to pull and merge something from master:
git checkout master git pull origin master git checkout branch1 git merge master
is there a way to pull the master changes from my branch so I don't have the needed to do merge ?
git pull origin master
but from branch1 without switching to master branch.
I have 3 branches: every time there is something new in master, I don't want to switch to branch master. All I want is to pull the master new features into my branch, without going to the master branch.
You may want to use rebase, so that you can merge your master changes onto your branch you are working
git fetch origin # Updates origin/master git rebase origin/master # Rebases current branch onto origin/master
Also check out this question
Update: Recent Git versions provide a simpler way to do the equivalent of the above two commands.
git pull --rebase origin master # where --rebase[=(false|true|merges|preserve|interactive)]
From your working folder with branch1 checked out:
git fetch git merge origin/master
The fetch downloads changes from the remote repo to your machine, but does not apply them to your working folder. The merge applies what you just downloaded to your working folder (whichever branch you are currently on)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With