Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer not generating .git folder for packages

This is weird, seems like something small that I'm missing. A few days ago, when I composer install I get Vendor directories with their own .git, this allows me to make changes and update my own packaged repositories.

Today, after running composer install, the .git directories inside each package folder is missing! (I think this might have something to do with installing from cache?)

Could someone please try re-create this?

$ git clone https://github.com/nathankot/rbhpi
$ cd rbhpi
$ ./composer.phar install
$ cd vendor/rbhpi/core
$ ls -a

From the above commands, the .git directory is missing for me.

I couldn't find this spec in the docs, but I did find it in this faq item:

Remove the .git directory of every dependency after the installation

Any solutions to my problem?

like image 955
Nathan Kot Avatar asked Jan 14 '13 09:01

Nathan Kot


People also ask

Why can't I see my .git folder?

The . git folder is hidden to prevent accidental deletion or modification of the folder. The version history of the code base will be lost if this folder is deleted. This means, we will not be able to rollback changes made to the code in future.

How do I get my .git folder back?

Deleted . git folder can't be restored, unless you want to use a recovery tool. Anyway, since you've an online backup I think you should just clone it, if I where in ur place I would do the following: Then you can copy and paste changed files from ur existing local copy and then delete it.

Where does Composer get packages from?

Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer. json .


1 Answers

Composer prefers the dist package of your dependencies, meaning dowloading a .tgz from github and unpacking it. If you want the source, install your vendors with

composer install --prefer-source

This will do a git checkout like you want.

like image 171
Maerlyn Avatar answered Oct 26 '22 04:10

Maerlyn