git 本地与远程存储库
git local vs remote repository
我阅读了 git 及其行为,并尝试用乌龟 git 做了一个小实验。现在我不确定是否真正理解 git 基础知识,特别是 "places" of workspace/index/localRepo/remoteRepo ...
据我了解,最佳做法是将工作区与 localRepository
分开。
因此,使用 tortoiseGit,我创建了一个裸仓库“localRepo.git
”。
我还创建了单独的“workspace
”和“workspace2
”目录。在每一个中,我都克隆了 repo。
在这一点上,我认为在“workspace
”中创建一个新文件,并且commit
它应该使它出现在“localRepo.git
”的"Repo-browser"中",不幸的是事实并非如此......
事实上,我必须做一个 push
,才能在 repo-browser 中看到它,并在“workspace2
”中获取它,例如
所以这是我的问题,我认为 push
操作的目的是将我的修改放入远程存储库,但在这里我认为“localRepo.git
”是我的本地存储库... .
基本上,我想我不明白本地和远程存储库之间是否有区别。
It is my understanding that a best practice is to separate the workspace from the localRepository.
你从哪里得到这个想法的? Eclipse 中的 Egit 鼓励这样做,但我很少在其他地方看到这样做。
with tortoiseGit, I create a bare repo "localRepo.git
". I also created separated "workspace
" and "workspace2
" directories. In each one, I cloned the repo.
克隆存储库会创建一个新的存储库。此时您已经拥有三个本地存储库:一个裸存储库 localRepo.git
,以及 workspace
和 workspace2
.
中的两个非裸存储库
由于您从 localRepo.git
克隆了 workspace
和 workspace2
存储库,默认行为是将 localRepo.git
设置为远程(origin
) 在另外两个。您可以使用
查看您配置的遥控器
git remote -v
在大多数情况下,这比您需要的要复杂得多。通常一个本地存储库就足够了。
At this point, I thought that creating a new file in "workspace
", and commit
it should make it appear on the "Repo-browser" of "localRepo.git
", unfortunately it is not the case
提交 workspace
中的文件会将其提交到该存储库。
So here is my problem, I thought the push
operation's aim was to put my modifications to the remote repository, but here I think that "localRepo.git
" is my local repository
git push
将提交复制到另一个存储库(通常是远程存储库)。正如我们在上面看到的那样,localRepo.git
被配置为一个名为 origin
的远程服务器,用于其他两个存储库,因此 push
ing 默认将提交发送到那里。
我阅读了 git 及其行为,并尝试用乌龟 git 做了一个小实验。现在我不确定是否真正理解 git 基础知识,特别是 "places" of workspace/index/localRepo/remoteRepo ...
据我了解,最佳做法是将工作区与 localRepository
分开。
因此,使用 tortoiseGit,我创建了一个裸仓库“localRepo.git
”。
我还创建了单独的“workspace
”和“workspace2
”目录。在每一个中,我都克隆了 repo。
在这一点上,我认为在“workspace
”中创建一个新文件,并且commit
它应该使它出现在“localRepo.git
”的"Repo-browser"中",不幸的是事实并非如此......
事实上,我必须做一个 push
,才能在 repo-browser 中看到它,并在“workspace2
”中获取它,例如
所以这是我的问题,我认为 push
操作的目的是将我的修改放入远程存储库,但在这里我认为“localRepo.git
”是我的本地存储库... .
基本上,我想我不明白本地和远程存储库之间是否有区别。
It is my understanding that a best practice is to separate the workspace from the localRepository.
你从哪里得到这个想法的? Eclipse 中的 Egit 鼓励这样做,但我很少在其他地方看到这样做。
with tortoiseGit, I create a bare repo "
localRepo.git
". I also created separated "workspace
" and "workspace2
" directories. In each one, I cloned the repo.
克隆存储库会创建一个新的存储库。此时您已经拥有三个本地存储库:一个裸存储库 localRepo.git
,以及 workspace
和 workspace2
.
由于您从 localRepo.git
克隆了 workspace
和 workspace2
存储库,默认行为是将 localRepo.git
设置为远程(origin
) 在另外两个。您可以使用
git remote -v
在大多数情况下,这比您需要的要复杂得多。通常一个本地存储库就足够了。
At this point, I thought that creating a new file in "
workspace
", andcommit
it should make it appear on the "Repo-browser" of "localRepo.git
", unfortunately it is not the case
提交 workspace
中的文件会将其提交到该存储库。
So here is my problem, I thought the
push
operation's aim was to put my modifications to the remote repository, but here I think that "localRepo.git
" is my local repository
git push
将提交复制到另一个存储库(通常是远程存储库)。正如我们在上面看到的那样,localRepo.git
被配置为一个名为 origin
的远程服务器,用于其他两个存储库,因此 push
ing 默认将提交发送到那里。