Show / Hide Table of Contents

Feature Branch Workflow

The development of a new "Feature" take place in a dedicated branch.

  • Many developers can work together on a "feature" without influence on the master branch.
  • The master branch never contains broken code.
  • Fit well with Continuous Integration (CI) setup.

When a "Feature" is ready, the developer create a "Pull Request" to merge the changes with the master branch.

A new "Feature" is created.

Before the developer starts developing a new feature, it created an isolated branch to work on. A new branch can be created using the following commands or directly from Visual Studio.

git branch feature-foo
git checkout feature-foo

The developers edits, stages, and commits changes in the usual fashion. A feature can be build up with as many commits as necessary.

git status
git add <some-file>
git commit

Feature Branch - Step 1

Save the Feature branch to Central Repository

It a good practice to push a feature branch up to the central repository. This serves as a convenient backup, but also let other developers to collaborate on the feature. The next command pushes the local repository to the central repository (origin), an the -u flag adds it as a remote tracking branch. After setting up the tracking branch, the developer can call git push without any parameters to push changes to the branch.

git push -u origin feature-foo

Feature Branch - Step 2

The Feature is ready

When the development of a feature is complete, the developer must merge his changes into the master branch. To accomplish that, he muste file pull request letting the rest of the team know the feature is done.

But first, the developer should make sure the central repository has his most recent commits:

git push

Then, he files the pull request in Azure DevOps or Visual Studio, asking to merge the feature-foo into master

Feature Branch - Step 3

Pull Request is created

Another member of the team gets the pull request and must review the changes requested by the developer. He can decideds he wants to ask for modifications before integrating into the master branch. Feature Branch - Step 4

A real dialog can take place through back-and-forth via the pull request. One or many members should be requested to approve the pull request before it can be merged into the master branch. Feature Branch - Step 5

The "Pull Request" is accepted

When all reviewer of the pull request approve it, the feature branch is merged into the master branch. Feature Branch

  • Improve this Doc
In This Article
Back to top Copyright 2019 One Step Beyond