Reputation: 326
Since no one in our team is familiar with this question. I am asking this. I went through some articles and documentation, but this concept is very confusing.
My question is regarding the git branch merging. Currently we have a master branch, whose code is in production. This code is in the client's production machine.
The client is coming up with new set of requirements. We call it Phase2.
Now, We dont want to push the Phase2 code to production. The client may report bugs which will be fixed and pushed to production.
So our plan is to push the bugs to master and push the phase 2 code to production. If we follow this method and if we merge the master and phase2 branches, Will it retain the code in master and phase2 and merge it or else it will remove the latest code commits in master and only merge phase2 code.
Upvotes: 1
Views: 537
Reputation: 90316
You got it right: merging branches will retain modifications from both. So keeping apart merge conflicts, if you merge the master
branch (with bug fixes) into phase2
(with new features), the resulting state will have both bug fixes and new features.
Upvotes: 1
Reputation: 13725
git merge
merges everything from a branch to the actual checkout/branch. (By default at least. There are lots of specific cases and options.)
If you would like to keep some commits only in one branch, then you can't merge this branch to the other. You have to use cherry-picking or other techniques to move code from this branch to the master/other. Otherwise merge will merge everything.
Upvotes: 2