git clone vs copy paste, what's the difference?

柔情痞子 提交于 2019-12-10 00:58:49

问题


as stated in the subject

note: the git clone i mean is the git clone without any option, the one which is performed by doing "git clone /C:/my_origin_folder"


回答1:


This answer of mine regarding backup should give you some answer on clone vs copy: Moving a git repo to a second computer?

Main differences:

  1. When you clone, you get remote origin setup pointing to original repo, so that you can push to it.
  2. You don't get hooks and reflog ( and also old objects) and other remotes when you clone but you do when you copy

Note that when you clone with a folder path, the differences change subtly, as the objects and refs are usually just copied / hardlinked ( equivalent of --local which is the default with local folder paths)




回答2:


When you use git clone instead of copy paste, the original repository will be the origin.

Besides, when cloning on the same machine you can use --local to make it faster. From the manual page:

--local, -l

When the repository to clone from is on a local machine, this flag bypasses the normal "git aware" transport mechanism and clones the repository by making a copy of HEAD and everything under objects and refs directories. The files under .git/objects/ directory are hardlinked to save space when possible....



来源:https://stackoverflow.com/questions/7303765/git-clone-vs-copy-paste-whats-the-difference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!