[英]Git - get the changes from master and put them on my branch
git checkout master
git checkout -b newBranch
...
git commit
git checkout master
现在,master 发生了变化,我想将这些变化移动到我的 newBranch。
我该怎么办,我做 git rebase master? 还是 git 变基新分支? 还是完全不同的东西?
(为什么 git 没有让命名约定变得非常明显?)
git checkout master
git checkout -b newBranch (creating new branch)
// do stuff
git add .
git commit -m "your changes"
Now (go back to master and get the latest changes):
git checkout master
git pull origin master
Go back to your new created branch:
git checkout newBranch
git merge master (fix conflicts if there are any)
Now you have all the changes from master into your branch.
您也可以使用git rebase
,但这里有一篇有趣的文章,说明为什么不应该这样做: https://medium.com/@fredrikmorken/why-you-should-stop-using-git-rebase-5552bee4fed1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.