将更改从 master 合并到我的分支
Merging changes from master into my branch
我在 git 有两个分支:master
和 custom_branch
。
有人向 master
添加了一些我需要在 custom_branch
中使用的代码。我试过这个:
git branch custom_branch
git merge master
但是当我这样做时,它说:
Already up-to-date.
但是,当我比较 master
和 custom_branch
时,变化仍然不存在。我错过了什么?
P.S。我不想 rebase
因为其他人也使用这个分支。
git checkout custom_branch && git rebase master
这将使用 master
分支中的更改更新 custom_branch
。
不要忘记先确保 master
是最新的。 git pull
这也可以用 git checkout custom_branch && git merge master
关于为什么第一个(可能)是你应该使用的解释:When do you use git rebase instead of git merge?
回答我自己的问题,但是为了将更改从上游的 master 提取到我的自定义分支中,我这样做了:
git pull [URL TO UPSTREAM'S REPO] master
git merge master
将使用 local 主分支的更改更新当前分支,其状态将是您上次在该分支上拉取时的状态.
我想这就是您要找的:git merge origin master
我在 git 有两个分支:master
和 custom_branch
。
有人向 master
添加了一些我需要在 custom_branch
中使用的代码。我试过这个:
git branch custom_branch
git merge master
但是当我这样做时,它说:
Already up-to-date.
但是,当我比较 master
和 custom_branch
时,变化仍然不存在。我错过了什么?
P.S。我不想 rebase
因为其他人也使用这个分支。
git checkout custom_branch && git rebase master
这将使用 master
分支中的更改更新 custom_branch
。
不要忘记先确保 master
是最新的。 git pull
这也可以用 git checkout custom_branch && git merge master
关于为什么第一个(可能)是你应该使用的解释:When do you use git rebase instead of git merge?
回答我自己的问题,但是为了将更改从上游的 master 提取到我的自定义分支中,我这样做了:
git pull [URL TO UPSTREAM'S REPO] master
git merge master
将使用 local 主分支的更改更新当前分支,其状态将是您上次在该分支上拉取时的状态.
我想这就是您要找的:git merge origin master