开发者

What is the recommended way for me to use git in my Lithium project?

After searching through many PHP frameworks to figure out which to learn and use, I've tentat开发者_开发百科ively settled on Lithium. It looks great. Except, I'm not entirely sure how to best manage the Lithium apps I write in git, because of the recommended way of getting the code. The manual suggests:

git clone git://github.com/UnionOfRAD/framework.git my_app
cd my_app
git submodule init
git submodule update

This results in a non-empty main repository (2000+ commits in the history at present). Should I simply be committing my own changes within this same repository (in my own branches?) and pulling/merging when there are changes, or is there some other way that's recommended?

I know that I can also just download the files without cloning the repository, but since the manual indicates this is recommended I figured there must be a good reason and an ideal way of doing it. (I presume it makes it easier to update the framework when a new version comes out.)


It depends on your preferred setup. If I want to quickly get rolling then a checkout of the example app works great. It has a bootstap config, example controllers and some views. But once you transcend that I suggest creating your own baseline app-repo and deploying the framework itself pr server and not pr app. The app/config/bootstrap/libraries.php can easily be changed to load lithium itself from elsewhere.

So

  1. Deploy lithium pr server (/home/lithium is my preference)
  2. Create your own baseline app by copying the default li3 one and stripping/modifying it
  3. Create a flexible vhost configuration so you can just git clone base-app ~/sites/foo-app, or similar, for quickly get rolling with a new app.

I have my (out-of-date by now) baseline app on github


Yes. In git you get a copy of all the history. You can track your work in your own branch and synchronize as you see fit using pull or fetch.

Since you are using github, fork that repo and clone from the fork. Should you want to contribute, you can create pull requests.

EDIT:

Initially, all you need to do is clone:

git clone <url to the repo>
git submodule --init --recursive

If you are not contributing, then the workflow is easy from then on:

git fetch

to fetch the latest from github

git merge --ff-only origin/master
git submodule update --recursive

If you get errors because you changed a file by accident, you can

git reset --hard HEAD
git clean -xdf 

and start with the merge step again. You may need to go into the submodule directories and do the above 2 steps there if the changes happened there.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜