threads / discuss / 22286

Feature idea: Ignore content

Subject: Feature idea: Ignore content

## tl;dr

5 messages between Jan 19, 2010 and Jan 19, 2010.

replies: 4people: 4as markdown or json

Ramkumar Ramachandra· Jan 19, 2010, 13:29 UTC · lore
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?

Peter Krefting· Jan 19, 2010, 14:05 UTC · re: Ramkumar Ramachandra · lore

Re: Feature idea: Ignore content

Ramkumar Ramachandra:
> 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").

-- 
\\// Peter - http://www.softwolves.pp.se/
Dirk Süsserott· Jan 19, 2010, 19:14 UTC · re: Peter Krefting · lore

Re: Feature idea: Ignore content

Am 19.01.2010 15:05 schrieb Peter Krefting:
Show 9 quoted lines
> Ramkumar Ramachandra:
> 
>> 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

Jacob Helwig· Jan 19, 2010, 16:57 UTC · re: Ramkumar Ramachandra · lore

Re: Feature idea: Ignore content

On Tue, Jan 19, 2010 at 05:29, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
Show 9 quoted lines
> 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.

← back to recent threads