简体   繁体   English

Xcode的git存储库在哪里存储? 为什么在复制项目目录时会创建不同的存储库?

[英]Where is git repository of Xcode stored? And Why different repository is created when I copy project directory?

I'm using built-in git of Xcode. 我正在使用内置的Xcode git。

I think my project directory is just a working copy of repository. 我认为我的项目目录只是存储库的工作副本。

How can I know where repository is stored? 我如何知道存储库的存储位置?

And when I copied a project directory, a new different repository is automatically created for new project directory instead of sharing the repository of old project directory. 当我复制项目目录时,会自动为新项目目录创建一个新的不同存储库,而不是共享旧项目目录的存储库。
That is convenient but why that happend? 这很方便,但为什么会这样呢?

Git stores the repository in the top-most .git folder of your working directory. Git将存储库存储在工作目录的最顶层.git文件夹中。 So, if your code is in /Users/js/Code/MyProject , then the repository is in /Users/js/Code/MyProject/.git/ . 因此,如果您的代码位于/Users/js/Code/MyProject ,则存储库位于/Users/js/Code/MyProject/.git/

Git encourages every repository to contain a single "project". Git鼓励每个存储库包含一个“项目”。 Although it's possible to store unrelated branches that don't share any history in a single repository, that is very nonstandard and might be confusing to other people. 虽然可以在一个存储库中存储不共享任何历史记录的不相关分支,但这非常不标准,可能会让其他人感到困惑。

It's also possible , but discouraged, to store unrelated projects as subdirectories within a single working directory. 可以 ,但不鼓励将不相关的项目作为子目录存储在单个工作目录中。 This would make it difficult to see the history of each individual project, since you'd have to inspect each individual commit to figure out which project it affected, and merges would be downright painful . 这将使得很难看到每个单独项目的历史记录,因为您必须检查每个单独的提交以确定它受影响的项目,并且合并将是彻头彻尾的痛苦

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

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