Merging changes from master into my branch
Solution 1
git checkout custom_branch && git rebase master
This will update custom_branch
with changes from master
branch.
Don't forget to make sure master
is up to date first. git pull
This is also possible with git checkout custom_branch && git merge master
For an explanation on why the first one is (probably) what you should be using: When do you use git rebase instead of git merge?
Solution 2
Answering my own question but to pull changes from upstream's master into my custom branch I did this:
git pull [URL TO UPSTREAM'S REPO] master
Solution 3
git merge master
will update your current branch with the changes from your local master branch, the state of which will be that of when you last pulled while on that branch.
I think this is what you are looking for: git merge origin master
Darth.Vader
Machine Learning, Software Development, Tennis and coffee.
Updated on July 05, 2022Comments
-
Darth.Vader almost 2 years
I have two branches in git:
master
andcustom_branch
.Somebody added some code to
master
that I need to use in mycustom_branch
. I tried this:git branch custom_branch git merge master
But when I do that, it says:
Already up-to-date.
But, when I compare
master
andcustom_branch
, the changes are still not there. What am I missing?P.S. I don't want to
rebase
since other people also use this branch. -
Darth.Vader over 7 yearsthanks, but I don't want to rebase since others are also using this branch. Also, running the second command says everything is already up to date.
-
tehp over 7 years@Darth.Vader have you ran
git pull
before attempting to merge? -
Cloud about 3 yearsIn the end I did
git pull origin master
-
Ollie Williams almost 2 yearsAfter doing this I get this message "Updates were rejected because the tip of your current branch is behind hint: its remote counterpart." What should I do?