views:

32

answers:

2

I have a directory, in this directory I have many subdirectories. I want to track only 4 of them (I know they names).

Many people have access to the top directory, and some of them, sometimes are adding new subdirectories.

When I now list the status of the repo with the command

git status

I get a huge list of 'untracked' entries

How I can tell git, I'm only interested in the four directories I want to track ?

A: 

Hi,

Wouldn't adding the entries you don't want to track in a .gitignore file work?

Best

Vagaus
+3  A: 

.gitignore in the top level directory (or .git/info/excludes):

*
!/somedir_a/
!/another_dir/
!/dir.the.third/
!/one-last-dir/

But if multiple people have access to the top-level directory, they could damage your .git dir.

Alternatively, you could just run git status -uno (means “do not show untracked files”). Use git config status.showUntrackedFiles no to make git status work like this by default in that repository.

Chris Johnsen