tags:

views:

134

answers:

2

Git says to use

git add

to add untracked files to my repo.

I have run unsuccessfully

git add shells/zsh/keyboard_configs/
git add shells/zsh/references/
git add shells/zsh/keyboard_configs/*
git add shells/zsh/references/*

git add shells/zsh/keyboard_configs/*<TAB>
git add shells/zsh/references/*<TAB>
git add .

I still get that the files are untracked when I see it at

git status

How can you git-add files at long PATHs?


I run

$git status                                                                                                                                          ~/bin 
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       shells/zsh/keyboard_configs/
#       shells/zsh/references/
nothing added to commit but untracked files present (use "git add" to track)
$git add shells/zsh/keyboard_configs                                                                                                                 ~/bin 
$git add shells/zsh/references                                                                                                                       ~/bin

The following is what is unexpected. I would expect that I added the folders to be tracked and their contents too.

$git status                                                                                                                                          ~/bin 
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       shells/zsh/keyboard_configs/
#       shells/zsh/references/
nothing added to commit but untracked files present (use "git add" to track)
$
+2  A: 

It could be that the files in those folders are somehow ignored? Check your .gitignore and .git/info/exclude files.

Tanj
I have only .DS_Store, MacPorts and .todo in in .git/info/exclude, while I have .gitignore at home and it contains only http://dpaste.com/63048/
Masi
+5  A: 

Are these directories empty? If so, Git does not track empty directories.

If you really need to add those directories to your repository, try adding an empty ".gitignore" file in each one.

For some background information on this design decision, see this thread from the Git email list.

Tim Henigan
Those directories are not empty. --- Your last tip works. --- Thank you!
Masi
I believe this is also the case if all the files are in .gitignore (Same as empty dir to git)
Tanj