PhilippeVienne
PhilippeVienne

Reputation: 560

How make Git ignore subdirectories which are git repositories?

I've a git repository folder in which I clone other git repositories. How can the main repo ignore sub-repositories in git add -A command?

Upvotes: 1

Views: 359

Answers (3)

Ted Shaw
Ted Shaw

Reputation: 2306

unstage files

git reset HEAD

and clean index

git rm --cached -r repo1

add repo1 as a submodule, create a file .gitmodules contains below

[submodule "repo1"]
      path = repo1
      url = git://xx.com/repo1.gitt

More about git cache, stage and index

Upvotes: 2

VonC
VonC

Reputation: 1323343

A nested git repo will be "ignored" by default by any git add made in the enclosing repo.
Actually, as explained in "Git repository in a git repository", the parent rpeo would track the nested git repo state through a gitlink.

But you shouldn't need to ignore explicitly anything when doing your git add -A command.

Upvotes: 2

dontcare
dontcare

Reputation: 975

use git ignore for the folders where the repository is located

.gitignore file:

bin folderA picture.png

for example

Upvotes: 1

Related Questions