Reputation: 32446
How can I make git commit all files of one type, say *.el
except for certain .el
files that are specifically named. So, I have the following, but the *.el
seems to be overriding the .el
files that I name specifically,
*
ignoreme.el
ignoremetoo.el
!.gitignore
!*.el
I have tried putting the files to ignore after the *.el
as well, but no dice.
EDIT There are also many other files/directories that need to be ignored and that is the reason for *
Upvotes: 1
Views: 171
Reputation: 5479
If that's your .gitignore-file, try adding only the exact things you want to ignore, like so:
ignoreme.el
ignoremetoo.el
As far as I know, there is no reason to include a complete wildcard at the top (*
) - if Git even recognizes that; why would you ignore everything by default?
Something like git commit **.el -m "My commit message"
should work with my fixed .gitignore
file.
Update to comment: The concept still applies. Add all the exact things you want to ignore, for instance like this:
*.abc
*.def
ignoreme.el
ignoremetoo.el
bin
When committig/adding now (git add .
), all .el
files will be added except those who are ignored.
So you can mix and match with wildcards and specific files. What you should not do, is ignore everything and then try to unignore certain things - that will probably just make everything very complex to manage. You could for instance check out these gitignore-files to see what it's all about.
Upvotes: 0
Reputation: 2072
Won't git commit anything you don't have in .gitignore? So your .gitignore should be:
ignoreme.el
ifnoremetoo.el
What it looks like you're doing is trying to not ignore all .el files (which as far as I know git does by default), then trying to ignore a couple specific files, when all you have to do is ignore specific files.
Know what I mean?
Upvotes: 0