dongping9475 2011-06-09 14:14
浏览 55
已采纳

Git - 很少有git repos克隆和什么不是(PHP - 框架Lithium,ORM Doctrine 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.

  • 写回答

1条回答 默认 最新

  • dtyqeoc70733 2011-06-09 14:37
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥15 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)