Knowledge Base > Development & Code > Fork or Clone?

Fork or Clone? [Part 5 of 7]

Avoid the rookie mistake - know when to fork and when to clone


Note

This guide is written for solo developers working independently with Git. If you're working in a team or contributing to shared repositories, some practices may differ. We cover team workflows in Part 7.


Most beginners confuse forking and cloning, or think they're interchangeable. They're not. Understanding the difference is key to contributing to open source projects and managing your own.


What's a Clone?

Cloning is making a local copy of a Git repo:

"I want a working copy of this project on my computer."

  • It pulls the entire history (commits, branches, tags)
  • It's connected to the original repo's remote (usually called origin)
  • You can push/pull changes if you have permission

Use it when:

  • You own the repo
  • You're working inside a team with push access
  • You're contributing to a private/internal project

What's a Fork?

Forking is making your own copy of someone else's repo on GitHub:

"I want my own version of this project so I can edit it freely."

  • Forks live on GitHub under your account
  • You can clone your fork to your machine
  • You'll later make a pull request back to the original

Use it when:

  • You don't have write access to the original repo
  • You want to propose a fix or feature
  • You want to experiment without touching the main project

Fork + Clone = Collaboration Workflow

If you're contributing to an open source project:

  1. Fork the repo on GitHub
  2. Clone your fork locally
  3. Make your changes in a branch
  4. Push changes to your fork
  5. Open a pull request back to the original repo

We cover pull requests in detail in Part 6.


Why Does It Matter?

Beginners often clone a public repo, make changes, then wonder why they "can't push." That's because you're not a contributor, and cloning doesn't grant you write access.

Forking is your way around that. It gives you your own space to work, without breaking the original.


Common Pitfalls

  • Cloning when you should fork: leads to permission issues
  • Forking then never syncing with the original: your copy becomes stale
  • Forgetting where your remotes point: always double-check git remote -v

Best Practices

  • Clone if you're on the core team
  • Fork if you're contributing to someone else's project
  • Always create a new branch before making changes
  • Name your remotes clearly: use origin for your fork, and upstream for the original

TL;DR

  • Clone = local copy of a repo you have access to
  • Fork = your own GitHub copy of someone else's repo
  • Use forks for open source contributions, then submit pull requests
  • Keep remotes clear and stay in sync