Search code examples
gitversion-controlmergebranchgit-workflow

GIT workflow complicated


Its been very difficult to manage the git. My issue:

Lets say i have a project, and has branches called "master" and "develop" and say Mary works on a feature branch called "feature-payment" (this branch is created from master), mary finishes of the work on "feature-payment" branch then merges and pushes to develop branch.

Then john pulls the develop branch in his local. then he wants to do some css part. since he doesn't have the feature branch, he has to work on develop branch. then he makes changes and finishes the styling and pushes the develop branch.

When the feature is ready to made live, mary merges her branch to master, but john can't merge develop to master, since there are multiple features on develop branch which are not made live. In this case what should be done guys ?? Please help guide me with branching workflow .. this issue happens to me everytime. :(


Solution

  • You can merge specific commits from a branch without merging the entire branch (see here : How to merge a specific commit in Git)

    However, a more appropriate solution would be to merge from the feature branch into master once the code has been reviewed. The purpose of your develop branch is confusing in this context, as it seems to have changes that are both ready for production and not. To me, it seems like your issue could be resolved by just merging feature branches into master once the changes are reviewed sufficiently, instead of into this "middle" develop branch.