Feature branches and Gitflow

Intermediate · 32 min

Compare the three common branching models, feature branches, GitHub flow and Gitflow, and pick the lightest one that fits how you release.

Before thisWhat a branch isMerging: fast-forward and three-wayTags and releasesTrunk-based development

TechWorld with Nana · 32 min

Feature branches and Gitflow

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by TechWorld with NanaReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • A branching model is a team agreement about which branches exist, what each one means, and how work moves between them.
  • A feature branch keeps one piece of work separate until it is reviewed, and merges back into the shared branch.
  • GitHub flow is main plus short feature branches and pull requests, with main deployed after every merge.
  • Gitflow adds long-lived develop and release branches, plus hotfix branches, which fits software shipped in numbered versions.
  • Every extra long-lived branch is a place for work to wait and drift, so choose the model with the fewest branches that matches how you release.

Why teams need a model

Git does not tell you how to use branches. It gives you cheap branches and merges, and leaves the rest to you. On a solo project that is fine. On a team, the questions arrive fast: which branch is the one we deploy? Where do I start a new piece of work? Who decides when something is released?

A branching model is the written-down answer. It names the branches that exist, says what each one means, and says how changes travel between them. The three you will meet most often form a ladder from light to heavy.

Feature branches

The base idea is simple. main holds the code you trust. To change something, you make a branch, commit on it, and merge it back when it is done and reviewed.

git switch -c add-search-command
# work, commit, push
git push -u origin add-search-command

A feature branch isolates your half-finished work, so a broken intermediate state never touches main. It also gives review a natural unit: the diff between your branch and main.

GitHub flow

GitHub flow is feature branches with discipline added. There is one long-lived branch, main, and it is always deployable. Every change follows the same loop:

  1. Branch from main with a descriptive name.
  2. Commit and push regularly.
  3. Open a pull request, early if you want feedback.
  4. Merge after review and passing checks.
  5. Deploy main, ideally automatically.

That is the whole model. It suits websites, services and anything you can ship continuously. It is close to trunk-based development; the difference is mostly in how long branches are allowed to live and how much ceremony surrounds the pull request.

Gitflow

Some software is not continuously deployed. A library has numbered releases that people install. A mobile app goes through store review. A product may support version 1.x with fixes while 2.0 is being built. Here you need places to stabilise a release without freezing everyone else’s work.

Gitflow adds structure for that. It has two permanent branches and three kinds of temporary ones.

  • main holds released code. Every commit on it is a release, tagged v1.0.0, v1.1.0, and so on.
  • develop collects finished features for the next release.
  • feature/* branches start from develop and merge back into it.
  • release/* branches start from develop when a version is feature-complete. Only bug fixes and version bumps go in. When ready, the branch merges into main (and is tagged) and back into develop.
  • hotfix/* branches start from main to fix a production bug, then merge into both main and develop.

I built this layout in a scratch repository to check that the merges work as described. Feature into develop, develop into release/1.1, release into main tagged v1.1.0, hotfix from main tagged v1.1.1, then the hotfix merged back into develop. With --no-ff merges, git log --graph --all shows the diamond shapes Gitflow diagrams draw. The step people forget is the last one: skip the merge of the hotfix into develop and the bug reappears in the next release.

Choosing, honestly

More branches means more places for work to wait. Each long-lived branch has the same drift problem described in the trunk-based lesson, so Gitflow charges you for the structure it gives you. Use this as a rough guide.

You release… Start with
Continuously, one version in production GitHub flow or trunk-based
In numbered versions you must support in parallel Gitflow, or a lighter variant with release branches only when needed
Rarely, with a lot of manual testing Gitflow, and ask why releases are rare

Many teams that adopted Gitflow because it was famous later dropped develop and kept main plus short branches. Gitflow’s own author later noted it is a poor fit for continuously delivered software. Start with the lightest model and add structure when a real release problem forces it.

Whatever you choose, write it in the repository’s CONTRIBUTING.md, and enforce the parts that matter with branch protection and rulesets.

What the video covers

TechWorld with Nana’s “3 Git Workflows Every Developer Should Know (And When to Use Each)” is about 31 minutes and was published around January 2026 (YouTube shows “10 months ago”). Going by its title and description, it covers three workflows and when to pick each, which matches the ladder above. The description I could read is mostly a link to a separate checklist, and I could not read a transcript or chapters, so I cannot say which three it picks or how deep each gets. English is judged from title and channel. It is the longest video in this group, so treat it as the place to see the models compared rather than something to watch end to end. A short Gitflow-only explainer is linked under deeper.

Where this fits

Whichever model you pick, the commits inside it should say what they do in a consistent form. That is the next lesson: conventional commits and semantic versioning.

Check yourself

  1. 01In Gitflow, what is the difference between main and develop?

    main holds released code, with each release tagged. develop collects finished features for the next release, so it is ahead of main between releases.

  2. 02Why does Gitflow have hotfix branches?

    A production bug cannot wait for everything on develop to be release-ready. A hotfix branches from main, ships the fix, and is then merged into develop too so the fix is not lost.

  3. 03Your web app deploys every merge. Which model fits?

    GitHub flow or trunk-based development. With no numbered releases to maintain, develop and release branches only add waiting time.

  4. 04What problem do all long-lived branches share?

    They drift from the branch they will merge into, so integrating them gets harder over time, and the work on them is unseen by the rest of the team.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark