Doubt in use of git

4

We are migrating our version control from Subversion to Git.

Master , Develop and Master : Develop > Feature .

When we have to do a new customization a new branch Feature is created based on Develop and customization is developed, but when another developer has to do another customization he follows the same step, created another branch Feature based on Develop .

When the developer finishes customization, merge is branches Feature and Develop released for user to do validation.

The problem is that since both features are branch Develop when you migrate to Master to take only a feature and not the Develop .

I wonder if our flow is wrong, if that's how you work with Git.

    
asked by anonymous 16.08.2017 / 15:26

3 answers

4

The best git WorkFlow tutorial I've ever read: Comparing Workflows

In my opinion there are two important Branch missing in your project: Release and HotFix

    
16.08.2017 / 16:37
2

New branches of master always start. Even a dev , feature , or patch branch is in master too much can happen. Commits may change, there may be commits of dev branches that will no longer be used, someone can force push and ruin commits history by getting duplicates with different hashes, etc.

What's in master is guaranteed (and common to all branches / branches), whichever comes back should be rebase (for commits to be re-ordered) and then enter master .

It's good to separate concepts and think / decide what each branch does. Have a dev branch for months where everything will stop and only after merge in the master will usually generate problems. Short iteration cycles is best. This means that branches are not always active.

A tested template that I use is:

  • patch branch : 1 to 5 commits, some urgent fix
  • feature branch : 1 to 50 commits (more than that should maybe split in parts)
  • dev branch : 1 to 30 commits, to go managing non-urgent problems and backlog, always trying not to press more things than necessary

All 3 branches make merge directly in master when they are ready, and at that time other active branches make a rebase to master to import commits that have entered master .

    
16.08.2017 / 15:30
2

In my experience, the first thing you need to set before choosing a Workflow for git is what your cycle of releases .

The best model for your case depends on a main variable:

  

The code that is in production is continually changed with new   features as soon as they are ready (rolling release), or there is a   practice of incorporating all new features and bugfixes into one package   closed and release that for fixed release?

Note that in both cases it is crucial that new branches are created from the branch where they will be at the end of the process. Without intermediaries.

Rolling releases

This template is easy to use a less structured flow like Github Flow .

Having 2 main branches master and develop , all features are based on master . When they are ready they are incorporated into develop for homologation, and after release the feature is incorporated into master and released for production.

In this template develop is never embedded in master and often you delete develop and recreate from master when this branch gets "dirty" with changes that were never approved and will not be incorporated. Many companies prefer to call develop of staging in this case, to avoid confusion.

Fixed releases

In this case, a more structured process is worthwhile, such as Git Flow , illustrated in Diogo's reply.

In this process, the main branches master and develop serve different purposes than the previous flow. master is what you are running now, and develop is your next full release , meaning you know that code is stable and you are just waiting to finish the cycle to > all or develop in master . In this case then it makes sense that new branches are created from develop for developers to work on the most stable stable code.

In this process you often have other branches to test, for example a% of% where the test happens before the feature goes to staging and the important thing is that, at the beginning of each cycle, develop and develop be strictly equal.

    
17.08.2017 / 13:22