We have a scenario where we'd like to use two branches in our git workflow, otherwise known as develop
and master
.
The current flow is as follows:
- Create
feat-branch
- this branch will be based off ofmaster
. - Make your changes in
feat-branch
, then finally commit your changes, and push them upstream to the remotefeat-branch
. - Finally, the goal is you will eventually make two Pull Requests (via GitHub). One will be:
develop <- feat branch
and the other will bemaster <- feat branch
This methodology works perfectly fine for merging things into the master branch since the feature branch is already branching off of the master branch (aside from having to git pull origin master
every now and then when you are out of date - but this is expected (I personally like to rebase my feature branches as well)).
However, the idea is you will be making a Pull Request to develop
first (before you even make a secondary Pull Request to merge to master
).
Merging to the develop
branch becomes dicey at this point because each contributor is effectively making the same exact PR to both develop and master, which is creating different merge commit hashes in each respective branch with the same changes.
However, since everyone is branching off of master, this means those merge commits that end up in master eventually get merged back into the develop branch over time... this causes PRs to have erroneous differences being displayed which essentially say the same changes are being made by another person.
I'm guessing this is a mix of how commit hashes work in conjunction with the fact that every merge commit that is created after a Pull Request is merged into master ends up being included in a PR to the develop branch.
At this point I'm kind of just looking for maybe some sort of general direction or ideas regarding resolution, whether it be an entirely different way to approach the 2 branch model or something different altogether.
master
branch and axing the other branch altogether. The goal of the 2 branch model was to ensure we had some sort of buffer before something went tomaster
. Ideally you'd make a PR to develop ,test the changes, then eventually make the same PR from your feature branch to master.develop
andmaster
, usually) there is arelease
branch in between the two. You cut therelease
branch fromdevelop
, test it, tweak it, and then mergerelease
intomaster
in one fell swoop. How often do you merge feature branches, and how often to you release / deploy to production?master
are not allowed unless they're urgent bug fixes.