0

I have a problem in my workflow.

I have 2 Git Branch: dev, prod

I use codepipeline to automatically publish in his respective server content when code is pushed to git

So, if I push to dev, dev server automatically update.

Now, I have a conceptual problem.

All my team is committing to dev, so when I merge dev to prod all my dev changes will be deployed, even if there is some changes that are not estable for inst.

How should I manage it???

I was thinking about create an external branch, but each branch should be related to a server, so, I would need more infrastructure ( 1 server per branch, if I have 10 persons in team, 10 servers?) , and flow is being heavier, I don't like it too much.

Any idea how to fix it???

Juliatzin
  • 18,455
  • 40
  • 166
  • 325

1 Answers1

1

Easy, stop merging dev branch into prod branch. Each feature being worked on should have its own branch. Those feature branches should be merged into dev whenever they need to be deployed to dev, and merged into prod when they are ready to be deployed to prod.

Stop merging stuff into your prod branch that isn't ready for production (that should really go without saying). And don't have multiple devs working on multiple features all in the same branch.

Edit to further describe what I'm talking about:

  1. Dev 1 works on feature branch A:
    • git commit
    • git push origin A
  2. Dev 2 works on feature branch B:
    • git commit
    • git push origin B
  3. Both features A and B are ready for testing on the dev server:
    • git checkout dev
    • git merge origin/A
    • git merge origin/B
    • git push
  4. Feature A is ready for release to production, but feature B needs more work:
    • git checkout prod
    • git merge origin/A
    • git push
Mark B
  • 183,023
  • 24
  • 297
  • 295
  • but in this case, if I have a branch for feature, I must have a server x feature, to test it. It is not so viable – Juliatzin Mar 22 '16 at 17:54
  • I'm sorry but your comment makes no sense. Perhaps explain why you think you would have that issue. I assure you git is being used by MANY people in the way I just described without the issue you just described. – Mark B Mar 22 '16 at 17:58
  • @JuliatzindelToro see the explicit steps I've added to my answer. – Mark B Mar 22 '16 at 18:07
  • ohhh. ok I see. So, you don't merge from dev to prod, you merge from feature branch to prod. it makes sense! – Juliatzin Mar 22 '16 at 18:15
  • Now, after analyzing your answer, I realize we use Git Flow, and could not make it work the way you say. Working with Git Flow is a bad thing??? – Juliatzin Mar 22 '16 at 18:40
  • Are you sure git flow prevents you from merging a feature branch into multiple release branches? That doesn't sound right to me, but I don't use git flow because I've never seen a need for it. If you step back from your very specific question about Elastic Beanstalk and just search for a more general answer on how to use Git Flow with multiple release branches, you will find answers like this: http://stackoverflow.com/questions/16562339/git-flow-and-master-with-multiple-parallel-release-branches – Mark B Mar 22 '16 at 18:53