做(mkdir repo和cd repo之后)的区别是什么:
git init
git remote add origin git://github.com/cmcculloh/repo.git
git fetch --all
git pull origin master
and
git clone git://github.com/cmcculloh/repo.git
我的意思是,显然有一个更短,但除此之外,它们基本上是在做同样的事情吗?
做(mkdir repo和cd repo之后)的区别是什么:
git init
git remote add origin git://github.com/cmcculloh/repo.git
git fetch --all
git pull origin master
and
git clone git://github.com/cmcculloh/repo.git
我的意思是,显然有一个更短,但除此之外,它们基本上是在做同样的事情吗?
当前回答
克隆:将远程服务器存储库复制到本地机器。
Pull:获取其他已添加到本地机器的新更改。
这就是区别。
克隆通常用于获得远程回购副本。
Pull用于查看其他团队成员添加的代码,如果您在团队中工作。
其他回答
克隆:将远程服务器存储库复制到本地机器。
Pull:获取其他已添加到本地机器的新更改。
这就是区别。
克隆通常用于获得远程回购副本。
Pull用于查看其他团队成员添加的代码,如果您在团队中工作。
嗯,当我拉,当我克隆时,看到远程分支“4.2”时缺少什么?有些东西显然不一样。
tmp$ mkdir some_repo
tmp$ cd some_repo
some_repo$ git init
Initialized empty Git repository in /tmp/some_repo/.git/
some_repo$ git pull https://github.ourplace.net/babelfish/some_repo.git
:
From https://github.ourplace.net/babelfish/some_repo
* branch HEAD -> FETCH_HEAD
some_repo$ git branch
* master
vs
tmp$ rm -rf some_repo
tmp$ git clone https://github.ourplace.net/babelfish/some_repo.git
Cloning into 'some_repo'...
:
Checking connectivity... done.
tmp$ cd some_repo
some_repo$ git branch
* 4.2
Git clone <remote-url> <=>
创建一个新目录 Git init // init新的存储库 Git remote add origin <remote-url> // add remote Git fetch //获取所有远程分支 Git switch <default_branch> //切换到默认分支
git pull <=>
获取所有远程分支 合并当前本地分支和跟踪远程分支(不是另一个分支)(如果本地分支存在)
Git拉<远程> <分支> <=>
获取远程分支 合并当前本地分支和远程分支(如果本地分支存在)
它们基本上是一样的,除了克隆会设置额外的远程跟踪分支,而不仅仅是master。查看手册页:
将存储库克隆到新创建的目录中,为克隆存储库中的每个分支创建远程跟踪分支(使用git branch -r可见),并创建和检出从克隆存储库的当前活动分支派生出来的初始分支。
克隆-:它将在您的本地机器上创建完全相同的远程存储库项目副本。
Pull-:假设两个或两个以上的人共享同一个存储库。 (假设另一个人叫Syam) (存储库是你的项目存在于Github的地方)所以如果Syam在他的本地的同一个项目中做了一些更改,并将其推到远程存储库,所以无论Syam做了什么更改,这些更改都不会反映在你的本地。因此,要在本地反映这些新变化,你必须使用git pull。总的来说,我们使用git pull来更新项目。
所以基本上我们只使用git clone一次,而我们使用git pull很多次。