tags:

views:

31

answers:

2

Let's say I have this dir structure:

/project1
  /SomeFolder
  /obj
  /bin
/project2
  /obj
  /bin

Let's say each directory has source files I want to check in, but I don't want to check in /obj and /bin directories or their contents...

The way I did was

git add .

and than browse to each dir and do

git rm obj
git rm bin

As you can imagine this gets tedious especially if there are many directories... What is a better way to do something like that? Namely add multiple files with some exceptions, or remove all subdirectories with certain name?

update

to update multiple directories this will also work:

git rm */obj
+3  A: 

You could just add a .gitignore file for each project, right?

According to the docs:

The git add command will not add ignored files by default. If any ignored files were explicitly specified on the command line, git add will fail with a list of ignored files.

Jeff Standen
+2  A: 

You should add these to the .gitignore file in the root of your git project:

echo obj >> .gitignore
echo bin >> .gitignore
Andrew Vit
that's nifty.. although those 2 commands put both directories on same line... trying
Sonic Soul
oops, sorry. they should be on separate lines. You get the point...
Andrew Vit
well they are on sep lines going in, but end up on same line in file.. i guess some kind of "/r/n" has to be echoed in as well ?
Sonic Soul
echo should always add a newline unless you suppress it with the -n option.
Jeff Standen