Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I have a nested git repo inside a git-ignored folder?

I have a git repo which have following folders:

 _includes/  _layouts/  _plugins/  _posts/  _site/ 

_site folder is added in the .gitignore file.

Now can I have a git repo inside _site folder with different remote repo for push and pull? Will there be any conflict?

I have studied git submodules but I think it would be a overkill in my case, if the above stated method can work.

like image 202
Andrew-Dufresne Avatar asked Apr 18 '12 08:04

Andrew-Dufresne


People also ask

Can I have nested git repositories?

Git allows you to include other Git repositories called submodules into a repository. This allows you to track changes in several repositories via a central one. Submodules are Git repositories nested inside a parent Git repository at a specific path in the parent repository's working directory.

Can you put a git repository inside another git repository?

Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.


1 Answers

I think it should work. For main repo, _site folder does not exists. So what you have inside it doesn't matter. When you cd into _site you will be on that independent repo.

like image 190
Juan G. Hurtado Avatar answered Sep 24 '22 23:09

Juan G. Hurtado