Two Production Branches in Git?

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.

  • Reset local repository branch to be just like remote repository HEAD
  • How to find svn project author after migrate the project from svn to git?
  • which way to git merge?
  • git get previous revision number
  • How do I continue development once my pull has been applied, without using the pull request
  • How do you manage your dependency libraries?
  • 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.

  • How to find out my own composer package stability?
  • working with GIT and multiple projects
  • Git - Temporarily ignore trivial changes to files
  • How can I prevent the dialog on doing git commit --amend
  • How can I commit/push a git alias (in .git/config)?
  • Git: what is a dangling commit/blob and where do they come from?
  • 3 Solutions collect form web for “Two Production Branches in Git?”

    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.

    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.

    Look at this article, it should help you to understand and apply sane git workflow.

    Git Baby is a git and github fan, let's start git clone.