简体   繁体   中英

How to merge from two branches

There are two branches. I've pushed a commit in branch working . Now I want to merge it in master branch. How to do that and are there any possible conflicts? I mean if in my local machine I don't have some actual code from branch master , how should I merge them? Should it looks like this:

 git checkout master git merge working git push origin master 

Steps to merge branch "working" into branch "master":

  1. Make your code changes to "working"
  2. Commit changes locally
  3. Push "working" branch to remote repo
  4. Checkout "master" branch

    $ git checkout master

  5. [If you don't have the latest code]Pull from remote "master" to make sure your code is up to date:

    $ git pull origin master

  6. Merge branch "working" into "master"

    $ git merge working

  7. Fix any conflicts that may arise

  8. Test!
  9. If all is ok, push "master" back out to remote

    $ git push origin master

When you merge "working" into "master", there can definitely be merge conflicts. There is no way for us to predict whether or not you'll run into any, as that depends on what changes you have made in "working", and work others may have done on "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.

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