threads / discuss / 34925

Removing all notes containing a specific string

Subject: Removing all notes containing a specific string

## tl;dr

3 messages between Sep 13, 2013 and Sep 13, 2013.

replies: 2people: 2as markdown or json

Francis Moreau· Sep 13, 2013, 06:51 UTC · lore
Hello,

I'd like to know if that's possible to parse all notes to detect a special string and if it's the case, remove the note like "git-notes remove" would do.

Thanks
-- 
Francis
Johan Herland· Sep 13, 2013, 08:12 UTC · re: Francis Moreau · lore

Re: Removing all notes containing a specific string

On Fri, Sep 13, 2013 at 8:51 AM, Francis Moreau <francis.moro@gmail.com> wrote:
Show 5 quoted lines
> Hello,
>
> I'd like to know if that's possible to parse all notes to detect a
> special string and if it's the case, remove the note like "git-notes
> remove" would do.
Hi,

There's no built-in command/option to do this, but the following shell one-liner should do the job:

  git grep -l $mystring refs/notes/commits | cut -d':' -f2 | tr -d '/'
| xargs git notes remove
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Francis Moreau· Sep 13, 2013, 15:43 UTC · re: Johan Herland · lore

Re: Removing all notes containing a specific string

On Fri, Sep 13, 2013 at 10:12 AM, Johan Herland <johan@herland.net> wrote:
Show 15 quoted lines
> On Fri, Sep 13, 2013 at 8:51 AM, Francis Moreau <francis.moro@gmail.com> wrote:
>> Hello,
>>
>> I'd like to know if that's possible to parse all notes to detect a
>> special string and if it's the case, remove the note like "git-notes
>> remove" would do.
>
> Hi,
>
> There's no built-in command/option to do this, but the following shell
> one-liner should do the job:
>
>   git grep -l $mystring refs/notes/commits | cut -d':' -f2 | tr -d '/'
> | xargs git notes remove
>
Looks "magic" to me but does the trick
Thanks !
-- 
Francis

← back to recent threads