Git - 很少有 git repos 克隆以及其他什么(PHP - Lithium 框架,ORM Doctrine 2)

发布于 2024-11-14 16:59:22 字数 420 浏览 1 评论 0原文

我对 git (一般来说是 vcs)相当陌生,所以我需要有关下一个案例的帮助。

我想开始一个新项目,该项目将使用 phplithium 框架和原则 2 构建。

案例:

  • 我有一个主项目 git 存储库,现在我想添加 ( 锂框架,来自 github。

  • 我有一个主项目 git 存储库,现在我想在里面添加(克隆)锂框架,来自 github。

    接下来,我需要克隆学说 2 的 li3 扩展(它自动克隆自身和学说 2)。

问题:

  1. 这是正确的方法吗(我想不是)。
  2. 如何管理现有存储库内的克隆(尤其是第二部分,带有 li3 扩展和原则 2)。

提前致谢。

I'm fairly new to git (vcs in general) so I need help with this next case.

I want to start working on a new project, which will be built using php lithium framework, and doctrine 2.

Case:

  • I have a main project git repository, and now I want to add (clone) lithium framework inside, from github.

  • Next, I need to clone li3 extension for doctrine 2 (it automatically clones itself and doctrine 2).

Questions:

  1. Is this the right way (I suppose not).
  2. How do you manage cloning inside existing repository (especially that second part, with li3 extension and doctrine 2).

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三人与歌 2024-11-21 16:59:22

在 git 中,没有这样的“在现有存储库中克隆”(从技术上来说是有的,但我们不要让这变得比需要的更复杂)。您所描述的看起来像是您想要使用锂框架和学说作为库。

通常,您不需要将外部库放入您的存储库中。仅当您打算修改库代码并将其置于版本控制之下时,才需要执行此操作。

但您应该首先考虑您想要做什么:是否将其集成到存储库中。我认为后者更容易。

您只需先创建自己的 git 存储库即可。然后排除库文件夹中您不希望受版本控制的部分。所以一开始你就可以很容易地将事情分开。

要进行设置,首先在磁盘上创建不带 git 的项目。创建文件系统和目录布局。然后在项目主目录中初始化 git 存储库。这只是在该目录中调用 git init 。

现在,当您输入 git status 时,Git 将显示其中所有文件的状态。在进行第一次提交之前,您可以使用 gitignore(5) 手册页 中描述的方法来排除您不希望将其包含在 git 存储库中的库和(可能是 IDE 的配置文件)。

您始终可以通过检查 git status 的输出来检查您正在编辑的配置是否符合您的需求。

请记住,git 会忽略空目录,因此如果您不想添加某个文件夹,只有当它至少包含一个文件时,它才会开始显示在状态中。

当您不希望受版本控制的所有文件都从状态列表中消失时,您可以执行第一次提交:git commit -m "Initial Commit."

根据您是否配置了 git,它会给您一个有关您的姓名和电子邮件的错误。错误消息会向您指出您需要了解的内容。只是每次提交都有一个作者和电子邮件,这很有用。

就这样了。检查网络上的命令:

  • git init
  • git status
  • git commit

使用 git help *command* 非常容易,就像 git help init 一样。学习 git 需要一些时间,所以可能会创建一些测试存储库来玩。一旦您学习了这些命令并习惯了它(如有疑问,请用谷歌搜索您的问题),使用它会非常酷。

In git there is no such "cloning inside existing repository" (well technically there is but let's don't make this more complicated than needed). What you describe looks like that you want to use the lithium framework and doctrine as a library.

Normally you don not need to put external libraries into your repository. You only need to do this if you plan to modify the library code and put it under version control.

But you should think first about what you would like to do: integrate it into the repository or not. I think the later is the easier one.

You just create your own git repository first. Then you exclude that part of the library folder that you don't want to have under version control. So you can keep things apart quite easily in the beginning.

To set this up, first create your project on disk w/o git. Create the file system and directory layout. Then initialize the git repository within the project's main directory. That's just calling git init inside that directory.

Git will now show the status of all files you have in there when you type git status. Before you do the first commit you can use the methods described in gitignore(5) Manual Page to exclude the libraries and (perhaps configuration files of your IDE) that you do not want to have inside the git repository.

You can always check if the configuration you're editing matches your need by checking the output of git status.

Keep in mind that git ignores empty directories, so if there is a folder you don't want to be added, it will start to show in the status only if it contains at least a file.

When all the files you don't want to have under version control have disappeared from the status listing, you can do your first commit: git commit -m "Initial Commit.".

Depending if you have configured git or not, it will give you an error about your name and email. The error messages point you to what you need to know. It's just that you have an author and email for each commit, which is useful.

And that's it already. Check the web for the commands:

  • git init
  • git status
  • git commit

it's quite easily with git help *command*, like git help init. It takes some time to learn git, so probably create some test-repository to play around. Once you've learned the commands and get used to it (in case of doubt, google your problem), it's supercool to use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文