Reputation: 26321
I have applied git to /var/www/classes
. I would like git to track all files in it included those in /var/www/classes/dont_include
(i.e. I don't want to use .gitignore
to exclude this directory).
How do I add (stage) all files except those in /var/www/classes/dont_include
?
/var/www/classes
/var/www/classes/included1
/var/www/classes/included2
/var/www/classes/dont_include
Upvotes: 2
Views: 132
Reputation: 3055
Currently you don't want to ignore that directory, rather adding in another commit you should either manually specify files/directory or add all than remove that directory.
If you've a lot of files/directory, specify each one would take a lot of time.
So removing that folder is much faster and easier. You can do that from /var/www/classes
as follow:
$ git add .
$ git reset -- dont_include
In your staging area you'll now find everything but dont_include
Upvotes: 1
Reputation: 681
Another possible way is using --assume-unchanged, as per github's help.
Before adding, do
$ git update-index --assume-unchanged /var/www/classes/dont_include
After committing, do
$git update-index --no-assume-unchanged /var/www/classes/dont_include
Upvotes: 2
Reputation: 43364
You can do one of these
Add the other folders manually
$git add included1/ included2/
Add everything and remove the unwanted folder from the staging area
$git add .
$git reset -- dont_include/
Upvotes: 2