Cloning and updating repositories with Git

Mar 11, 2015 • Sarah W

Both of my questions are for the same lesson: Version Control with Git - Collaborating.

Question 1:

To update your local repository with the most recent changes from a remote repository, you would use the command:

a) git push origin master

b) git pull orgin master

c) git remote -v

Question 2:

When you want to copy a remote repository onto your local computer for the first time, you would do which of the following commands:

a) mkdir origin
   git init
   git remote add origin

b) mkdir origin
   git init
   git clone

c) git clone

Discussion of Question 2:

a) Originally when I started learning git, everything I read seemed to imply you needed to create the directory, then initialize the directory with git, and then add the remote repository, and magically everything would work. If someone picks this option, I know they do not know that the git clone command copies/downloads everything onto the local machine, makes the directory, and that part of the copying includes the git.init directory.

b) If this option is picked, then I know the person knows the git clone command is the right one to make a copy of the remote repository, but does not realise they do not need to make the directory. (It sounds silly, but this part was really messing me up when I started learning).

c) The correct answer.

For both questions I did not include a fourth answer (d) as they would have been “fish” answers.