简体   繁体   English

在哪里放置本地git存储库

[英]Where to put local git repository

I'm converting to Git after working for several years with SVN. 在SVN工作了几年之后,我正在转换为Git。 When working with SVN I had a "repos" directory on my server and individual directories within that for the individual projects (and hence where I would create the individual SVN repos). 当使用SVN时,我在服务器上有一个“ repos”目录,在该目录下有单个项目的单个目录(因此,我将在其中创建单个SVN仓库)。 So I was very clear about my repo living on my server and I had a working copy on my local drive. 因此,我非常清楚我的存储库位于服务器上,并且本地驱动器上有工作副本。 All good. 都好。

The scenario I will now have is that I will be hosting some projects on Visual Studio Team Services (was Visual Studio Online) using Git. 现在,我将使用Git在Visual Studio Team Services(以前是Visual Studio Online)上托管一些项目。 I understand that I have a remote repo and a local repo in this environment and that they are effectively clones. 我了解在这种环境下我有一个远程存储库和一个本地存储库,它们是有效的克隆。 What about a local working directory? 本地工作目录呢? Do I still need this? 我还需要这个吗? I ask because I have seen posts that refer to running "git init" inside the local project directory, which tends to indicate that my hidden "git" directory will live within my local copy that I am working from. 我之所以这样问,是因为我看到过一些帖子,它们涉及在本地项目目录中运行“ git init”,这往往表明我隐藏的“ git”目录将存在于我正在使用的本地副本中。 ie the working directory and the local repo are one in the same? 即工作目录和本地仓库在同一? Is this correct or best practice or should I still make a local repo directory for my local git repo and have a separate working directory? 这是正确的还是最佳做法,还是我应该为我的本地git repo制作一个本地repo目录,并有一个单独的工作目录?

I hope that makes sense. 我希望这是有道理的。 Please ask for any clarification. 请要求任何澄清。

ie the working directory and the local repo are one in the same? 即工作目录和本地仓库在同一?

This is not correct. 这是不正确的。 the working directory is files you are editing and modifying, the local repo is a hidden directory, usually named as .git in the top level of your working directory. 工作目录是您正在编辑和修改的文件,本地存储库是隐藏目录,通常在工作目录的顶层命名为.git。

Your local repo is used to keep your local modification history, which is the same as the repository you used with SVN. 本地存储库用于保留本地修改历史记录,该历史记录与您在SVN中使用的存储库相同。 but git, as a distributed VCS, provide a set of mechanism to synchronize your local repo and the remote one. 但是git作为分布式VCS,提供了一套机制来同步本地存储库和远程存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM