Git & GitHub Collaboration Workflows - Fork & GitHub Flow!
Master professional collaboration workflows: Fork Workflow, GitHub Flow, Git Flow, Trunk-Based Development!
Introduction
Let's learn professional Git workflows used by teams around the world!
What You Will Learn
- Fork Workflow
- GitHub Flow
- Git Flow
- Trunk-Based Development
Prerequisites
Workflow 1: Fork Workflow (Great for Open Source!)
For contributing to open source projects!
graph LR
A[Original Repo] -->|Fork| B[Your Fork]
B -->|Clone| C[Your Local]
C -->|Push| B
B -->|Pull Request| A
Steps:
- Fork the original repo!
- Clone your fork locally!
- Add upstream remote!
- Create a feature branch!
- Make changes!
- Push to your fork!
- Open a pull request!
Workflow 2: GitHub Flow (Simple & Popular!)
Great for most teams!
- Create a branch from main!
- Add commits!
- Open a pull request!
- Review and discuss!
- Deploy to test!
- Merge!
Workflow 3: Git Flow (More Complex!)
Uses multiple long-lived branches:
- main/master (stable releases!)
- develop (active development!)
- feature/*
- release/*
- hotfix/*
Good for projects with scheduled releases!
Workflow 4: Trunk-Based Development!
Merge small changes to main often! Use feature flags! Great for CI/CD!
Which Workflow Should You Choose?
- Open source: Fork Workflow!
- Small teams, continuous deployment: GitHub Flow or Trunk-Based!
- Scheduled releases: Git Flow!
Best Practices!
- Small commits: Easier to review!
- Clear PRs: Explain what and why!
- Code review: Have someone review your code!
- Communicate: Talk to your team!
Summary
Choose a workflow that fits your team!
Related Articles
Previous Tutorial
Next Tutorial
Let's learn open source! → Open Source Contributions