简体   繁体   中英

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

I have a bug 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

如果你只是想将bug修复程序集成到分支中,那么git cherry-pick相关的提交。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM