What is the difference between pull and clone in git?
What is the difference between doing (after mkdir repo and cd repo):
git init
git remote add origin git://github.com/chandra/repo.git
git fetch --all
git pull origin master
and
git clone git://github.com/chandra/repo.git
I mean, obviously one is shorter but other than that are they basically doing the same thing?
git clone vs pull
What is git clone
git clone is how you get a local copy of an existing repository to work on. git pull (or git fetch + git merge ) is how you update that local copy with new commits from the remote repository.
git clone is used for just downloading exactly what is currently working on the remote server repository and saving it in your machine's folder where that project is placed. Mostly it is used only when we are going to upload the project for the first time. After that pull is the better option.
What is git pull?
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration workflows.
git pull is a (clone(download) + merge) operation and mostly used when you are working as teamwork. In other words, when you want the recent changes in that project, you can pull.
The clone will setup additional remote-tracking branches.