Git/clone

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Git
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
  • Action: clones a repository into a new directory
  • Format: git clone <URL.git>

A "clone" is a new copy of an existing project repository.

The files will be placed in a subfolder of the current folder, and will refuse to put anything into an existing folder – so if you already have a project folder set up, you'll need to delete it (or rename it temporarily if you need to merge the contents).

I'm not sure what this means, but it seems relevant → After cloning, a plain git fetch without arguments will update all the remote-tracking branches, and a git pull without arguments will in addition merge the remote master branch into the current master branch, if any, unless the "--single-branch" option is used. (Note that these would need to be executed inside the project folder. Doing a "git pull" right after "git clone ..." resulted only in the message "Already up-to-date." when I tried it just now.)

Question

  • Q: What happens if you clone a repository into the same directory you cloned it into earlier?
    • A: You can't; the clone command will respond "fatal: destination path '<project name>' already exists and is not an empty directory.".

Links

Documentation