简体   繁体   中英

git: I merged master into develop, now what?

I'm a one man shop and I've been working on a development branch for quite a while. I wanted to merge the branches and get back to one branch...master. Somehow, and I'm not sure how, I merged the branches and now I'm on develop.

Should I somehow delete one of the branches?

How do I fix this to have one branch and it be master?

git checkout master

The above command will put you in the master branch

git merge develop

Above will bring whatever is in the develop branch into your master branch

git branch -d develop

Above will delete the develop branch

However, i suggest keeping the develop branch.

Commit and push your changes on your current branch then do:

git merge development
git checkout development
git merge master
git branch -D development

I would like to add these for your convenience. When you are going with continuous development, it's better you follow a particular branching model. I think git-flow will be one model suits for you. Or you can follow your own convenient one.

The key points you want to know are

  • Keep develop branch for continuous integration of development.
  • Start implementing a particular feature form a feature branch derived from develop branch.
  • After you are ready to put a stable release, merge all the changes from develop branch to master , and put the release. Make sure mater always has a stable version.

For your particular question, I would answer this way.

git checkout master
git pull development

I don't recommend you to delete development branch.

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