Popular GIT Workflows
Popular Git Workflows

Introduction
Different teams use different workflows. This lesson covers the most popular Git workflows and when to use each.
Feature Branch Workflow
Each feature on its own branch.
main: A---B---C---D
\
feature: E---F
How It Works
1. Create branch from main 2. Work on feature 3. Create pull request 4. Review and merge 5. Delete feature branch
Commands
# Start feature
git checkout main
git pull
git checkout -b feature-new-featureWork and commit
git add .
git commit -m "Add feature"Push and create PR
git push -u origin feature-new-featureAfter PR merge
git checkout main
git pull
git branch -d feature-new-feature
Pros
- Simple to understand
- Good for small teams
- Features isolated
Cons
- Can cause integration issues
- No formal review process (without PR)
Gitflow Workflow
More structured with specific branch types.
Branch Types
main- Production codedevelop- Integration branchfeature/*- New featuresrelease/*- Release preparationhotfix/*- Emergency fixes
main: A---B---C---D---E
\ \
develop: F---G---H---I---J
| |
feature: K---L |
release: M---N
Commands
# Start feature
git checkout develop
git checkout -b feature-new-featureFinish feature
git checkout develop
git merge feature-new-feature
git branch -d feature-new-featureStart release
git checkout develop
git checkout -b release-1.0Finish release
git checkout main
git merge release-1.0
git checkout develop
git merge release-1.0
git branch -d release-1.0Start hotfix
git checkout main
git checkout -b hotfix-fix-bugFinish hotfix
git checkout main
git merge hotfix-fix-bug
git checkout develop
git merge hotfix-fix-bug
git branch -d hotfix-fix-bug
Pros
- Clear structure
- Good for releases
- Organized
Cons
- Complex
- Many branches
GitHub Flow
Simpler, GitHub-centric workflow.
Rules
1. Branch from main 2. Work on branch 3. Open Pull Request 4. Review and discuss 5. Deploy and test 6. Merge to main
Commands
# Create branch
git checkout main
git pull
git checkout -b feature-nameWork, commit, push
git add .
git commit -m "Description"
git push -u origin feature-nameCreate PR (via GitHub)
After approval and deploy
git checkout main
git pull
git branch -d feature-name
Pros
- Simple
- Continuous delivery
- GitHub integrated
Cons
- Requires good tests
- Deploy-first mindset
Trunk-Based Development
Developers work in main or short-lived branches.
Principles
- Branches live less than 2 days
- Small, frequent commits
- Feature flags for incomplete features
main: A---B---C---D---E---F---G
\ \ \
feature1 H---I---J \
\
feature2 K---L
Commands
# Very short branch
git checkout main
git pull
git checkout -b feature-smallQuick work
git add .
git commit -m "Quick feature"Back to main quickly
git checkout main
git merge feature-small
Pros
- Fast integration
- Reduces merge hell
- Continuous integration
Cons
- Requires strong testing
- Feature flags required
Forking Workflow
Contribute without direct repository access.
original-repo/main: A---B---Cfork-repo/main: A---B---C---D
fork-repo/feature: \
E---F
How It Works
1. Fork repository on GitHub 2. Clone your fork 3. Create branch on your fork 4. Make changes and push 5. Create Pull Request to original
Commands
# Clone your fork
git clone https://github.com/you/repo.git
cd repoAdd upstream
git remote add upstream https://github.com/original/repo.gitCreate branch
git checkout -b featureMake changes
git add .
git commit -m "Add feature"Push to your fork
git push origin featureCreate PR to original repo
Pros
- Open source friendly
- No permissions needed
- Clean contributor workflow
Cons
- More complex
- Synchronization challenges
Choosing a Workflow
| Workflow | Team Size | Release Cycle | Complexity |
|---|---|---|---|
| Feature Branch | 1-10 | Any | Low |
| Gitflow | 5-20+ | Scheduled releases | High |
| GitHub Flow | 2-50 | Continuous | Low |
| Trunk-Based | 10+ | Continuous | Medium |
| Forking | Any | Any | Medium |
Summary
Choose workflow based on:
- Team size
- Release frequency
- Project complexity
- Tooling (GitHub, GitLab, etc.)
Next Lesson
Learn about Git hooks and plugins to extend functionality.
Quiz - Quiz - Popular Git Workflows
1. In Gitflow, which branch contains production code?
2. What is the main characteristic of Trunk-Based Development?
3. Which workflow is most common for open source contributions?
4. In GitHub Flow, when should you create a Pull Request?
5. What is a fork in GitHub?