开发者

How can I keep my branch up to date with master with git?

开发者 https://www.devze.com 2023-02-25 03:44 出处:网络
I have a bu开发者_开发百科g fix in my master, and I also want my branch to get that bug fix.What git command do I use?Assuming you\'re fine with taking all of the changes in master, what you want is:

I have a bu开发者_开发百科g fix in my master, and I also want my branch to get that bug fix. What git command do I use?


Assuming you're fine with taking all of the changes in master, what you want is:

git checkout <my branch>

to switch the working tree to your branch; then:

git merge master

to merge all the changes in master with yours.


If your branch is local only and hasn't been pushed to the server, use

git rebase master

Otherwise, use

git merge master


You can use the cherry-pick to get the particular bug fix commit(s)

$ git checkout branch
$ git cherry-pick bugfix


If you just want the bug fix to be integrated into the branch, git cherry-pick the relevant commit(s).

0

精彩评论

暂无评论...
验证码 换一张
取 消