質問

When I create a new project, I usually do a git init in the project directory and then download the source of whatever framework I'm using (FuelPHP, django, etc) and copy it over to the project directory. This way, I don't have two sets of git information.

This sucks because it isn't easy (I can't just git clone) and upgrading is more of a chore.

What is the best way to manage this? Should I set a new remote within git after I create the project directory? Something like:

cd project_dir
git init
git remote add origin GITHUB_URL
git remote add fuelphp FUEL_GITHUB_URL
git pull fuelphp master
git add .
git commit -m 'adding fuel'
git push origin master

Or is this considered bad practise?

役に立ちましたか?

解決

If you manage your project in git and the "framework" is managed in git, too, then you have different possibilities:

  • Just copy the files from your framework to your project. (This is good, if you don't want a copy of the whole history of the framework, but makes updates a bit ugly.)
  • Use git submodule to include the other repository. (In your project you basically store a pointer to a commit in the framework repository.)
  • Use git subtree this pretty much integrates the commits of the framework into your project and allows easy upgrades.

You have to find out which way is best for your situation.

You can find a nice article on the topic here.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top