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 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分