Skip to contentSkip to conversation

Feature idea: Ignore content

DISCUSSION Ramkumar Ramachandra 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw
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.

#2 lore raw
In reply to Ramkumar Ramachandra

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/
#3 lore raw

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