Skipping git folder inside the repository

Asked

Viewed 545 times

2

How do I ignore folders . git/ and . gitignore within my project?

I’m having problems cloning external vendors in my project because of this, every time I clone/download some dependency with Poser it comes with the git folder and when committing the changes the folder that contains the . git/ does not send or add to git add --all

  • put it inside . gitignore

  • The "vendor" folder will always be ignored anyway, because it is individual. Because for each application Composer will download all its dependencies individually, that is, if you have 3 applications, Composer.phar will be only 1, however vendors will be specific to each project.

  • Read it here, it may help you: http://tableless.com.br/composer-um-pouco-basic/

  • Here in the company are using a CMS that installs with a php and does not come Composer.json.

  • So you can browse the directory vendor you have to enable it by the Composer. "config": { "vendor-dir": "3rdparty" }

  • So the way is really drag. In your case.

  • But strange, because if you clone a dependency with Composer, I imagine there is Composer.json

  • git add --all, or git add . ? git add --all is to remove all not?

  • In the dependencies there are the json, my application that does not exist, understand?

Show 4 more comments

1 answer

2

In several dependency managers, it is good practice not to include the files downloaded by the manager within your repository, always being downloaded through the manager. If so, add the manager folders/files to the .gitignore.

If you prefer to download other repositories inside yours, you can use submodules.

To add a submodule to your project use:

git submodule add https://github.com/chaconinc/DbConnector

Where the URL will be from the repository you are downloading.

When cloning a repository with submodules, they will come empty by default. To download them, use:

git submodule init
git submodule update

So you update the settings and download the submodule repository.

  • 2

    Hello Erick, you can give some example of the link you have placed. If this link breaks one day, the answer is invalid.

  • Edited. I removed the link and included the basic commands in the reply.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.