Feature idea: Ignore content
Hi,
Often, I find that I need to track a file which contains a small portion I don't want to track (read: line with a password). Instead of moving that out to a separate file and ignoring that file, is it a good idea to add a feature to Git to allow ignoring content instead of whole files? Since Git by nature tracks content, this shouldn't be too hard to implement, right?
Quoted 9 lines · Ramkumar Ramachandra
Hi,
Often, I find that I need to track a file which contains a small portion I don't want to track (read: line with a password). Instead of moving that out to a separate file and ignoring that file, is it a good idea to add a feature to Git to allow ignoring content instead of whole files? Since Git by nature tracks content, this shouldn't be too hard to implement, right?
Generally, the way I've seen this handled is by tracking an example file, and ignoring the "real" file with the password.
Something like:
config/database.example.yml <-- Tracked file, with a dummy password
& connection info.
config/database.yml <-- Ignored file, actually used by application.
Ramkumar Ramachandra:
Quoted 1 line
Instead of moving that out to a separate file and ignoring that file, is it a good idea to add a feature to Git to allow ignoring content instead of whole files?
You should be able to do that by setting up a filter. Please see gitattributes(5) for more information (search for "filter").
Signature · 1 line
\\// Peter - http://www.softwolves.pp.se/
Am 19.01.2010 15:05 schrieb Peter Krefting:
Quoted 6 lines
Ramkumar Ramachandra:
Quoted 1 line
Instead of moving that out to a separate file and ignoring that file, is it a good idea to add a feature to Git to allow ignoring content instead of whole files?
You should be able to do that by setting up a filter. Please see gitattributes(5) for more information (search for "filter").
Hi Ramkumar,
please have a look at this thread:
http://marc.info/?t=125882165900001&r=1&w=2
especially Björn's suggestion to use a 'clean filter'. It worked fine for me with a similar problem: I wanted Git to ignore a certain pattern in my files.
HTH,
Dirk
Quoted 1 line
Fantastic- I had no idea that such a feature even existed. I got it to work nicely. Thanks!