MeltingDog MeltingDog - 1 month ago 17
Git Question

When to use Git Clone and Git Pull?

I'm new to git and am struggling with this concept.

Here's my scenario: I have set up a branch on my local. I now want to get the files from a branch(?) on github so I can work on them.

Which do I use and why?

Answer

Use clone when you don't have a copy of the repository on your current machine, or if you want to make a new, separate copy.

Use pull when you have a copy of the repository, and you want to pull in changes from some outside source (often, but not always, the place you cloned it from).

Which do I use and why?

In this case, neither one really applies. You want to check out the remote branch. Most likely using git checkout -t origin/branchname, which sets up a tracking branch.

Comments