1

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?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
PhilippeVienne
  • 550
  • 8
  • 19

3 Answers3

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
2

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

Ted Shaw
  • 2,298
  • 14
  • 8
1

use git ignore for the folders where the repository is located

.gitignore file:

bin folderA picture.png

for example

dontcare
  • 935
  • 3
  • 16
  • 34