Sitemap
Beth Hollinger

Beth Hollinger

4 min readJul 28, 2023

--

Understanding Git and GitHub for Beginners

What’s the difference between git clone and fork?

When I first became familiar with version control and the world of Git and GitHub — during my software engineering boot camp, my head was spinning with questions. It was after boot camp — that I had time to digest the information and make sense of some of the more complex (and simpler) aspects of Git. I had to delve deeper into Git/GitHub to get a firm grasp of the concepts, and the appropriate time to use them. To be clear, some of the Git abstractions are still to me just that, abstract. In this article, I am going to shed some light and share some of the nuances that I have learned in my journey into the “git-a-verse”. Enjoy!

So what is the difference between “git clone” and “fork”? According to GitHub docs, “a clone is a copy of a repository(repo) that lives on your computer instead of on a website’s server somewhere, or the act of making that copy (GitHub Docs, Glossary, 2023).” Whereas, “A fork is a personal copy of another user’s repository that lives on your account(GitHub Docs, Glossary, 2023).”

With git clone, you can make changes on your own local git repository without having to be online and then push the changes up when you go back online. Here you will need access through permission from the owner of the repo to make any changes. These changes will eventually impact the original repository (origin). Cloning usually works well with group projects. Beware, synchronizing when pushing up to the repo can lead to bugs if not managed well.

With forking, however, you make your own git repository on GitHub. From your original repo, you can make changes to your copy origin without affecting the original repository from which you forked it. When you push changes from your local repository, they go to your remote repo, not the one that you forked it from (unlike with “git clone”). According to McKenzie (2021), “developers who contributed to the Git repository that was forked will have no knowledge of the newly forked repo.” Also, developers will not be able to update your forked repo (without access given by you). After you fork a repo, you must clone it from your own newly forked repository. So you still need to clone it?! Yes, there is no terminal command for “fork” so you will need to clone the repo too after you hit the fork button on GitHub’s Web Interface.

Besides having your own repo, the great benefit of forking is that any changes you make won’t affect the original owner’s repo. The beauty of forking with version control, however, is that you can still submit your work to the original owner’s repo with a pull request. That way you can feel free to experiment with the code without worrying about damaging the source code or the original owner’s repo while still being able to contribute to a project.

In summary:

Get Beth Hollinger’s stories in your inbox

Join Medium for free to get updates from this writer.

Fork

  • Creates your copy to your repository in a remote location (ie. GitHub)
  • Your changes will not affect the original repository from which it was forked (copied)
  • Needs to be cloned to your local computer
  • Requires pull requests to update source code

Clone

  • Local copy of a repository (not your own) on your (local) computer
  • Directly linked to the original repository — will make changes directly to the original directory (if permitted)
  • Can only push, fetch and pull to the original repository with permissions
  • Changes will be integrated when pushed

This article is a high-level, elementary explanation of forking vs. cloning. I would be remiss if I didn’t mention that there is much debate in the tech industry regarding which workflow is the preferred method (Mobley, 2017). I hope that this article helps demystify some of the perplexity that is forking and cloning. I would welcome your thoughts and feedback! Thank you for your time!

References

  1. Arash (2023, January 1). What is the difference between forking and cloning in Git? Educative.io. Retrieved July 17, 2023, from https://www.educative.io/answers/what-is-the-difference-between-forking-and-cloning-in-git
  2. Fernandez, A(2022) #35849 [The difference between forking and cloning a repository on GitHub #35849, Discussion] https://github.com/orgs/community/discussions/35849.
  3. GitHub (2023, January 1). GitHub Docs. Https://Github.com/. Retrieved July 17, 2023, from https://docs.github.com/en/get-started/quickstart/github-glossary
  4. [Jad Kahil]. (2023, January 1). Git: Become an Expert in Git in 4 Hours [Video]. Udemy/VideoLab. https://www.udemy.com/course/git-expert-4-hours/learn/lecture/11682140?start=45#overview
  5. McKenzie, C. (2021, July 28). Git fork vs. Clone: What’s the difference? Https://www.theserverside.com/. Retrieved July 17, 2023, from https://www.theserverside.com/answer/Git-fork-vs-clone-Whats-the-difference
  6. Mobley, D. L. (2017, September 6). Recommendation to clone vs fork? #14. Https://Github.com/. Retrieved July 17, 2023, from https://github.com/livecomsjournal/article_templates/issues/14
  7. Rajora, H. (2021, July 7). Difference between Git Clone and Git Fork. Https://Toolsqa.com. Retrieved July 17, 2023, from https://toolsqa.com/git/difference-between-git-clone-and-git-fork/#:~:text=It%20is%20a%20better%20option,there%20is%20no%20command%20involved

--

--