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:

  1. Fork the original repo!
  2. Clone your fork locally!
  3. Add upstream remote!
  4. Create a feature branch!
  5. Make changes!
  6. Push to your fork!
  7. Open a pull request!

Workflow 2: GitHub Flow (Simple & Popular!)

Great for most teams!

  1. Create a branch from main!
  2. Add commits!
  3. Open a pull request!
  4. Review and discuss!
  5. Deploy to test!
  6. 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!

  1. Small commits: Easier to review!
  2. Clear PRs: Explain what and why!
  3. Code review: Have someone review your code!
  4. Communicate: Talk to your team!

Summary

Choose a workflow that fits your team!

Related Articles

Previous Tutorial

Remote Repositories

Next Tutorial

Let's learn open source! → Open Source Contributions