← Back to Mission Control

Ship Replication

2 min read

Forking Repositories

Mission Phase 22 • Difficulty: Beginner

Creating Your Own Version

Forking creates a personal copy of someone else's repository under your GitHub account. You can modify it freely without affecting the original.

Why Fork?

How to Fork

  1. Go to the repository on GitHub
  2. Click the "Fork" button (top right)
  3. Choose your account
  4. GitHub creates your copy

Fork vs Clone

Typically: Fork on GitHub, then clone your fork locally.

Workflow: Fork → Clone → Contribute

# 1. Fork on GitHub (use web interface)

# 2. Clone your fork
git clone git@github.com:yourname/repository.git
cd repository

# 3. Add upstream remote (original repo)
git remote add upstream git@github.com:original/repository.git

# 4. Create feature branch
git switch -c my-improvement

# 5. Make changes and commit
git add .
git commit -m "Add amazing feature"

# 6. Push to YOUR fork
git push origin my-improvement

# 7. Create pull request on GitHub

Keeping Fork Updated

# Fetch from original repository
git fetch upstream

# Merge into your main
git switch main
git merge upstream/main

# Push updates to your fork
git push origin main

Pull Requests

After pushing to your fork, create a pull request to propose changes to the original repository. Maintainers review and may merge your contribution.

Next: Crew Coordination

You can now fork and contribute. Next, learn team workflows for effective collaboration.