mtpultz
mtpultz

Reputation: 18268

When you clone a repo like Laravel into an existing project do you pull it in as submodule even if you're not planning to contribute?

I'm confused on what you do when you've created your own project repo, and then I want to add another repo to it like Laravel 4. It seems from Git Pro that submodules might be what I want, and if it is the way to do this will conflict arise with regards to similarly named files like readme.md? Is this what I'm looking for or is there another solution?

UPDATE: Currently I'm cloning laravel into my /root, then deleting the associated .git folder, then cloning our base installation files that include package.json, bower.json, /docs, /config/, etc etc etc; into my /root, deleting that .git folder, then invoking composer install and npm install, running git init, and finally pushing it the projects remote git repo on BitBucket. The deleting of .git for each cloned repo seems weird (which started this question), so I thought submodules after some searching, but submodules install to subfolders, which I don't want since that doesn't allow for all the CLI to be at a single level, among other things.

Upvotes: 1

Views: 1127

Answers (1)

VonC
VonC

Reputation: 1324937

You shouldn't need submodules.
Once Laravel is installed, you can follow this Laravel recipe to manage your application with Git, provided your application is a Laravel project.

laravel:~$ cd myapp
laravel:~/myapp$ git init

Notice the file composer.lock is not tracked? You should edit .gitignore and removed the line that has composer.lock in it. This way you'll be tracking composer.lock too.

When you track composer.lock with your source code control system it allows you to do a composer update on your development machine and then, later, a composer install on your production machine.
The composer install command will make sure all packages are the correct version as specified in the composer.lock file. Thus production uses not only the same packages, but the same versions of the packages as your production machine

laravel:~/myapp$ git config --global user.email "[email protected]"
laravel:~/myapp$ git config --global user.name "Your Name"

laravel:~/myapp$ git add .
laravel:~/myapp$ git commit -m "initial checkin"

Upvotes: 2

Related Questions