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.

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

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题