I work in web development and the team I work on is growing so I see the need to hammer out a more formal Git workflow. We have a process down that is working for now but it's starting to cause more problems than it solves.

Currently, we work off of a dev and master branch. The dev branch is checked out to our dev environment, master to our test environment, and our prod environment is checked out to a tag from master.

I've been reading up on Gitflow and a common theme is checking out feature branches from the dev branch.

Our team tends to have a number of irons in the fire at one time, each with different timelines and can't necessarily follow a regular release schedule at this time. If Developer A checked out a new feature branch from dev, made a quick fix, received approval, and pushed up to master, then deployed to prod there's a good chance they'd unintentionally deploy code from Developer B that was being reviewed on the dev environment.

To avoid this, our general practice has been to create feature branches off of master as it's always reflective of what's on production. Then, merge them into dev for review, then up to master once approved.

A frequent thorn in my side is that over time the dev environment gets "messy" due to its sandbox nature and will occasionally have abandoned features or tests that are left there and not necessarily cleaned up.

How can we improve this process? Is there a better workflow or process we should look into?

1 Answer 1


It sounds like what you have ended up with is dev and master as effectively forks of the code base, rather than branches: features are merged to each more-or-less independently, and there is no process to keep them in sync.

Most workflows with multiple long-lived branches instead treat one branch as the "future" of the other. For instance, features are first merged to dev, "baked in" for some period of time, and then the whole of dev is merged to master and released to test and then production. This doesn't have to be after a regular amount of time, it just needs to be more common than merging the feature straight to master.

If it's never (or only very rarely) merged as a whole to master, you have to ask yourself why things are being merged to the dev branch if they're not also ready for master:

  • Are you frequently testing how unfinished features interact with each other, because it's a frequent cause of errors? Maybe better architecture or planning could let you work on more things at once without doing that.
  • Are you treating features as "complete" which are then rejected by QA or users? Maybe the code needs to stay on a feature branch for longer before being merged anywhere.
  • Do you have to merge something to dev before it can be tested by non-developers? Maybe you need to have one or more servers where feature branches can be checked out for testing.
  • Is the branch not actually serving any purpose, or does its previous purpose no longer apply? Maybe you can switch to "mainline development" AKA "develop on master", where each feature is merged directly to master when ready. Just make sure you read up on how to do that safely and effectively.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.