What is the Difference between git clone and git fork?

Daniel Pericich
2 min readDec 31, 2023
Photo by Bank Phrom on Unsplash

There are many ways to modify and improve code using git for version control. Your ownership of existing repositories affects the implementation of these tools. Two common ways to get local copies of code and modify this code are cloning and forking repositories. One of these code modification patterns is a git tool, while the other is a Github method. Let us talk about the difference between git clone and forking git repositories.

What is git clone?

Git clone is a git command allowing a user to copy an existing repository to a local directory. This command sets up remote branch tracking and defaults to the main branch of the origin repository.

This command is a method that works similarly to downloading a file from the internet. You are downloading all the code from a repository including the default branch and remote tracking for git. Because of this download functionality, there are many methods to pull the code. Git supports multiple transfer protocols: git by default, but also ssh, http, https, ftp, and ftps. Be cautious of using git on unsecured or public networks as it does not require authentication by default.

It is easiest to clone public repositories. If you are trying to clone a private repository, you either need to be the owner of this repository or a member of the organization that owns the repo.

What is forking a Repository?

Unlike git clone, forking with git is not a command, but a Github tool. With forking, the user makes a separate copy of a repository as a new, personal repository. This allows the user to use, modify, and extend the existing code without affecting the original repository and code. A Github user can fork any public repository.

One of the most common uses of forking a repo is for developers to propose fixes for existing project issues. Forking is common for open-source projects where a few maintainers may need to track and respond to dozens if not hundreds of contributors’ code.

These contributors can create forked repos, make changes to the code, and open pull requests against the original repository. The owners of the original repository can approve and merge the pull requests as is, or they can modify the pull requests with their own commits and even delete the pull requests if they are not needed.

Users are not limited to forking repos to propose changes and fixes to existing code. Another use case for forking a repo is to use the code as a base for other projects. There is no reason to reinvent the wheel when building different projects. Forking a repo allows developers to have a non-blank canvas to work with.

--

--

Daniel Pericich

Former Big Beer Engineer turned Full Stack Software Engineer