Implementing GitFlow in Azure DevOps: A Practical Guide
Introduction
Working on teams with multiple features, bugfixes, and releases simultaneously often leads to merge conflicts, unplanned hotfixes, and release chaos. A structured branching strategy helps mitigate these issues — and GitFlow is one of the most established models for that.
In this post, we’ll walk through how to adopt GitFlow in Azure DevOps, using tooling from the Gitflow-in-Azure-DevOps repository, and integrate it with pull requests, policies, CI/CD, and release control.
What Is GitFlow?
GitFlow is a branching model introduced by Vincent Driessen. At its core:
- master: Always reflects production-ready code
- develop: Integration branch for features that will go into the next release
- feature/ branches: For individual feature development (branched off develop)
- release/ branches: For preparing a release, stabilization, final bug fixes
- hotfix/ branches: For emergency fixes on production (branched off master)
When a feature is done, it’s merged into develop. When you’re ready for release, you branch off develop into a release branch. Hotfixes branch from master and go back into both master and develop.
This flow helps isolate ongoing development from stable code, enabling multiple streams of work concurrently.
Why GitFlow + Azure DevOps?
Azure DevOps adds a suite of features that complement GitFlow nicely:
- Pull requests & code reviews: ensure changes are reviewed before merging
- Branch policies: enforce rules (e.g. required reviewers, build success) on certain branches
- CI/CD pipelines: you can tie builds and deployments to specific branches
- Traceability: link work items, enforce that PRs reference work items, etc.
Using GitFlow in Azure DevOps gives teams structure + discipline, while still leveraging automation and governance.
Overview of the Gitflow-in-Azure-DevOps Tooling
The repository provides:
- Shell / batch scripts to alias git commands to GitFlow-style operations
- Automation to create pull requests (e.g. when publishing a feature / release)
- Configuration files and templates to help bootstrap your repo
- Helpers for cleanup (e.g. deleting merged branches)
This saves you from writing all the glue code yourself, and ensures consistency.
Prerequisites & Setup
Before using:
- An Azure DevOps organization / project with Git repos.
- A Personal Access Token (PAT) with permissions to create PRs etc.
- VSTS / Azure DevOps CLI configured locally.
- Git installed.
- Clone the repository and run the install script.
- Use the git flow commands :)))
You’ll also want to configure branch policies on master / develop branches to enforce PRs, require reviewers, and block direct pushes.
Walkthrough:
Here’s a sample of how you’d use the tool:
🔰 Step 1: Download and install the latest version of git:
🧰 Step 2: Install VSTS-CLI
Download the VSTS_CLI .exe installer and install it on your windows.
Get Ali Ghelichkhani’s stories in your inbox
Join Medium for free to get updates from this writer.
Verify:
vsts --version⚠️ Note: VSTS-CLI is deprecated, but still usable for local workflows like GitFlow automation.
🔑 Step 3: Create a Personal Access Token (PAT) in Azure DevOps
- Go to your Azure DevOps organization (e.g.
https://dev.azure.com/your-org-name). - Click your profile picture → Personal Access Tokens.
- Click New Token.
- Give it a name like
GitFlowAutomationToken. - Select:
- Organization: your organization
- Scopes: choose
Full access(orCode (Read, Write, & Manage)if limited) - Expiration: typically 90 days or longer
6. Click Create and copy the token immediately (you won’t see it again).
🔗 Step 4: Configure CLI to Connect to Azure DevOps Using PAT
using VSTS-CLI (legacy):
vsts login --instance https://dev.azure.com/<your-org> --token <your-PAT>
vsts configure --use-git-aliases yesset the domain to be the default instance:
vsts configure --defaults instance=https://dev.azure.com/<your-org>verify the login:
vsts configure --list
vsts project list📦 Step 5: Download and Install the GitFlow-in-Azure-DevOps Project
- Clone the GitHub repository:
$git clone https://github.com/AliGhelichkhani/Gitflow-in-Azure-DevOps.git cd Gitflow-in-Azure-DevOps2. Run the provided install.bat file (Windows only):
install.batThis will:
- Verify you have Git and VSTS-CLI installed
- Set up aliases (like
git flow.feature.start) - Configure environment variables
- Optionally create necessary folders or scripts
3. After installation, you should be able to use commands like:
$git flow.init
$git flow.feature.start feature-xyz
$git flow.feature.publish🧪 Step 6: Verify Installation
Run:
$git flow.init
vsts --helpIf all respond without errors, your setup is complete.
🧩 1️⃣ Feature Workflow (for New Development)
This is your day-to-day workflow for developing new features.
➤ Step 1: Create a Feature Branch
$git flow.feature.start "$feature_name"
# or
$git ffs "$feature_name"This command:
- Creates a new branch named
feature/”$feature_name” fromdevelop - Switches your workspace to that branch
💡 Tip: Always name features descriptively (e.g. feature-user-auth).
➤ Step 2: Make Code Changes
Edit your code or add new files as needed. Example:
# edit files
code src/components/LoginForm.js➤ Step 3: Commit Changes
Once you’ve made some progress:
$git add .
$git commit -m "$commit_message"You can make multiple commits locally — keep them small and meaningful.
➤ Step 4: Push to Remote (optional before PR)
You can push manually:
$git push -u origin feature/"$feature_name"But the tool’s publish command does this automatically.
➤ Step 5: Publish Feature (Create Pull Request)
$git flow.feature.publish "$PR_title | $PR_description | $reviewer_id"
# or
$git ffp "$PR_title | $PR_description | $reviewer_id"This does 3 things automatically:
- Pushes your branch to Azure DevOps.
- Creates a Pull Request (PR) from your feature branch →
develop. - Uses your README.md file as the PR description template.
Once created, you’ll see the PR in Azure DevOps → Repos > Pull Requests.
➤ Step 6: Complete PR & Merge
After review and approval:
- Merge PR in Azure DevOps UI.
- The feature branch will merge into
develop. - Delete the branch when done (either manually or run cleanup script):
$git general.clean🔧 2️⃣ Hotfix Workflow (for Production Bugs)
Used for emergency fixes on the master branch.
➤ Step 1: Create Hotfix Branch
$git flow.hotfix.start "$hotfix_name"
# or
$git fhs "$hotfix_name"This:
- Creates
hotfix/“$hotfix_name” frommaster - Switches your branch to it
➤ Step 2: Fix the Issue
Edit and commit:
$git add .
$git commit -m "$commit_message"➤ Step 3: Publish Hotfix (Create PRs Automatically)
$git flow.hotfix.publish "$PR_title | $PR_description | $reviewer_id"
# or
$git fhp "$PR_title | $PR_description | $reviewer_id"This creates two PRs in Azure DevOps:
Target BranchPurposemasterto deploy the fix to productiondevelopto sync the fix back into development
After approval, both PRs get merged appropriately.
➤ Step 4: Tag the Release (Optional)
After merging, you can tag the fix version:
$git tag -a v1.0.1 -m "$hotfix_name"
$git push --tags🚀 3️⃣ Release Workflow (for Preparing a Version)
Used when you’re stabilizing a new release from develop.
➤ Step 1: Start a Release Branch
$git flow.release.start "$release_branch_name"
# or
$git frs "$release_branch_name"This:
- Creates a branch like
release/release-v1.0.0fromdevelop - Used for final testing, bug fixes, documentation, etc.
➤ Step 2: Make Adjustments or Version Updates
Example:
# update version numbers or docs
code package.jsonCommit your changes:
$git add .
$git commit -m "$commit_message"➤ Step 3: Publish Release (Auto PRs)
$git flow.release.publish
# or
$git frp "$PR_title | $PR_description | $reviewer_id" This creates two PRs:
TargetPurposemasterfor the release deploymentdevelopto merge back the post-release changes.
➤ Step 4: Merge PRs and Tag the Release
Once both PRs are merged:
$git tag -a v1.0.0 -m "$release_message"
$git push --tags🧹 Optional Maintenance Commands
Deletes merged local & remote branches
$git general.cleanForce-adds default .gitignore patterns
$git general.ignore.forceRe-initialize GitFlow structure
$git flow.init🏁 Wrapping Up
By integrating GitFlow with Azure DevOps, you bring structure, automation, and governance into your team’s development workflow.
With the Gitflow-in-Azure-DevOps project, you don’t just follow branching conventions — you automate them. From feature creation to release publishing, the .bat scripts and CLI integrations streamline pull request creation, enforce naming consistency, and keep your mainline branches protected.
This setup helps teams:
- Work on multiple features and releases in parallel
- Enforce code quality through pull requests and branch policies
- Automate repetitive tasks like PR creation and cleanup
- Maintain traceability and consistency across environments
If you haven’t yet, try cloning the repo and running a full feature → release → hotfix cycle in your own Azure DevOps project. You’ll quickly see how this workflow enhances collaboration and predictability in your CI/CD pipelines.
🔗 GitHub Repository: AliGhelichkhani/Gitflow-in-Azure-DevOps
💬 If this guide helped you, share your feedback in the comments or drop a ⭐️ on the repository — it helps others discover it too!





