Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

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?

1 Answer

0 votes
by (50.2k points)

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.

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.

For more details about clone refer: https://git-scm.com/docs/git-clone#_description 

Related questions

Browse Categories

...