I have two branches in git: master
and custom_branch
.
Somebody added some code to master
that I need to use in my custom_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
and custom_branch
, the changes are still not there. What am I missing?
PS I don't want to rebase
since other people also use this branch.
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
回答我自己的问题,但要将更改从上游的 master 拉到我的自定义分支中,我这样做了:
git pull [URL TO UPSTREAM'S REPO] master
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
You probably still have to pull the changes to your local master branch. Before your commands, use git checkout master
and then git pull
Just do:
git fetch origin master
And then do:
git merge master
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.