4

Could you explain the difference between git clone, git pull and git fetch? I have read some other answers but none of them state the difference between the three clearly.

gisdio
  • 59
  • 1
  • 1
  • 4
  • 1
    You must read the doc of git first. Git is not friendly enought for beginner. Posing a question like this is not helpful unless you read the doc. Otherwise, you may can't even understand the answers here. – Yves May 29 '21 at 07:25
  • 1
    Here's an intro: https://www.biteinteractive.com/picturing-git-conceptions-and-misconceptions/ – matt May 29 '21 at 08:30

1 Answers1

7

1 git clone

The clone command in git is used when you want to download an existing git repository to your local computer.

2 git pull

When you want to take changes or updates done by other developer/team member on git repository, you have to use git pull.

In detail git pull is the command that fetches the content from a remote repository and integrates it with the local repository/branch. It is, in actuality, a combination of git fetch and git merge called in that order.

3 git fetch

Git "fetch" Downloads commits, objects and refs from another repository. It fetches branches and tags from one or more repositories.

For more details study these:

  1. https://git-scm.com/docs
  2. https://www.datacamp.com/community/tutorials/git-push-pull
Divyesh
  • 2,085
  • 20
  • 35