This repository's workflow is based on the well-known development strategy called git-flow. Understanding git-flow will help you see why the rules are structured the way they are!
git-flow is a set of rules for how to use Git branches when multiple people are developing together. It was proposed by Vincent Driessen in 2010 and has been adopted by many projects worldwide.
In git-flow, each branch is given a role, and development follows a defined procedure. This prevents code conflicts and confusion, enabling smooth team development.
💡 git-flow is useful even when working solo! Since each branch is dedicated to a specific feature, it's easy to see at a glance what each branch is for — keeping your work organized and easy to follow. The git-flow approach is recommended not only for team projects but also for managing your own research code.
git-flow uses the following 5 types of branches.
| Branch | Role |
|---|---|
main |
Holds stable, released code |
develop |
Integrates code currently in development |
feature/xxx |
Used to develop individual features |
release/xxx |
Used for final adjustments before a release |
hotfix/xxx |
Used for urgent bug fixes in production |
main ●─────────────────────────────────────● release
\ /
hotfix \ ●────────────────●
\ / /
develop ●───────────●────────────────●
\ / \ /
feature ●───────● ●────────────●
feature A done feature B done
This repository applies the git-flow concept directly.
| git-flow | This Repository | Role |
|---|---|---|
main |
main |
For releases and backups |
develop |
develop |
For development integration |
feature/xxx |
[name]_[feature] (local) |
For feature development |
| ─ | [name] (personal branch) |
Buffer between develop and feature |
💡 Key Point: Your personal branch
[name]acts as your own personal version ofdevelopin git-flow terms. Locally, treat[name]asdevelopand follow the git-flow approach!
Your local development flow is exactly the same as the git-flow develop → feature cycle.
[name] branch (= equivalent to develop in git-flow)
│
├─── Create [name]_[feature] branch (= git-flow feature branch)
│ │
│ │ Develop and commit repeatedly here
│ │
│ Done!
│ │
└─── Merge back into [name] branch (= feature → develop merge)
# Pull latest changes and create a working branch
git checkout mtanaka
git pull origin mtanaka
git checkout -b mtanaka_unet # create feature branch# Repeat work and commit
git add .
git commit -m "Add UNet encoder block"# Go back to [name] branch (= develop) and merge
git checkout mtanaka
git merge mtanaka_unet
# Push to remote
git push origin mtanaka
# Delete feature branch (recommended)
git branch -d mtanaka_unetFrom the GitHub web interface, create a Pull Request from mtanaka → develop.
This is the equivalent of "merging into develop" in git-flow!
The git-flow library lets you create, merge, and delete branches all in a single command!
# Using Homebrew (recommended)
brew install git-flow-avh
# Using MacPorts
port install git-flow-avhsudo apt-get install git-flowIf you are using Git for Windows (Git Bash), install with the following:
# Run in Git Bash
wget -q -O - --no-check-certificate \
https://raw.github.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh \
install stable | bash💡
wgetandutil-linuxare required.
git flow versionIf a version number is displayed, the installation was successful 🎉
With the git-flow library, the manual commands from the previous section become much simpler!
After cloning the repository, initialize git-flow once. You will be asked questions interactively — just press Enter for all of them to use the defaults.
cd welcome
git flow initYou will see prompts like the following (press Enter to accept all defaults):
Which branch should be used for bringing forth production releases?
- develop
- main
Branch name for production releases: [main] ← Enter
Which branch should be used for integration of the "next release"?
- develop
Branch name for "next release" development: [develop] ← Enter
How to name your supporting branch prefixes?
Feature branches? [feature/] ← Enter
Release branches? [release/] ← Enter
Hotfix branches? [hotfix/] ← Enter
Support branches? [support/] ← Enter
Version tag prefix? [] ← Enter
⚠️ In this repository,[name]acts asdevelopin git-flow terms. Read git-flow'sdevelopas your[name]branch (e.g.mtanaka) throughout.
# Without git-flow (manual)
git checkout mtanaka
git checkout -b mtanaka_unet
# ✅ With git-flow (simple!)
git flow feature start unet
# → "feature/unet" branch is automatically created and checked out# Same as normal git commands
git add .
git commit -m "Add UNet encoder block"# Without git-flow (manual)
git checkout mtanaka
git merge mtanaka_unet
git branch -d mtanaka_unet
# ✅ With git-flow (simple!)
git flow feature finish unet
# → Auto-merges into develop (= mtanaka), deletes branch, and switches back — all at once!git push origin mtanakaFrom the GitHub web interface, create a Pull Request from mtanaka → develop.
| Action | Manual Command | git-flow Command |
|---|---|---|
| Create feature branch | git checkout -b mtanaka_unet |
git flow feature start unet |
| Finish feature branch | git checkout mtanaka → git merge → git branch -d |
git flow feature finish unet |
| List active branches | git branch |
git flow feature list |
💡
git flow feature finishhandles merge, branch deletion, and switching back — all in one command!
| Action | In git-flow Terms | In This Repository |
|---|---|---|
| Start a new feature | Create feature branch from develop |
Create [name]_[feature] from [name] |
| Work in progress | Commit on feature branch |
Commit on [name]_[feature] |
| Finish development | Merge feature → develop |
Merge [name]_[feature] → [name] |
| Share with the team | Pull Request to develop |
Pull Request [name] → develop |
| Sync latest changes | Merge develop into feature |
Merge develop into [name] via Pull Request |
Warning
Do NOT push directly to the develop branch!
Always create a Pull Request from your [name] branch.
This rule also applies in git-flow. Since develop is everyone's shared integration branch,
pushing directly can cause conflicts with others' work or introduce unreviewed,
unfinished code into the shared codebase.
Check out these resources for more details on git-flow.