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?
            Asked
            
        
        
            Active
            
        
            Viewed 336 times
        
    1
            
            
         
    
    
        Jason Aller
        
- 3,541
- 28
- 38
- 38
 
    
    
        PhilippeVienne
        
- 550
- 8
- 19
- 
                    2Maybe you should consider using git submodules? – Nils Magne Lunde Aug 20 '12 at 06:21
3 Answers
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.
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
 
    