Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2022 12:17:12 -0300
From:      Renato Botelho <garga@FreeBSD.org>
To:        Drew Gallatin <gallatin@netflix.com>
Cc:        Kristof Provost <kp@freebsd.org>, Andrew Gallatin <gallatin@cs.duke.edu>, "Alexander V. Chernikov" <melifaro@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Conrad Meyer <cem@freebsd.org>, Andriy Gapon <avg@freebsd.org>
Subject:   Re: git: b1f7154cb125 - main - gitignore: ignore vim swap files & .rej/.orig
Message-ID:  <0a83179a-6bcc-a6e6-7719-28c7b5f2aac1@FreeBSD.org>
In-Reply-To: <898c0071-66bc-db5f-b70d-72429d167279@FreeBSD.org>
References:  <202201170935.20H9ZM3T069547@gitrepo.freebsd.org> <72061959-88f8-d2ee-b4e9-f09ca084411e@cs.duke.edu> <4FC1EDC4-9F20-4271-B468-715A1727AC8A@FreeBSD.org> <CADLQ3sKdAvci47RxK=Vqg4JA0Wff2z9dcuDrByWNdendQu=M%2Bw@mail.gmail.com> <4f4f6a83-3def-4938-6e40-5460486cc415@FreeBSD.org> <CADLQ3sJhbyCa2KmEKkhfUTPrzCv2nWcjA8CyLdGd-U2wr2ZB%2BQ@mail.gmail.com> <a493e61a-4405-0f5b-655f-d184f30e2be7@FreeBSD.org> <898c0071-66bc-db5f-b70d-72429d167279@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/02/22 12:12, Renato Botelho wrote:
> On 11/02/22 12:11, Renato Botelho wrote:
>> On 11/02/22 12:02, Drew Gallatin wrote:
>>> I think that has the same problem.  Either that, or I'm doing the 
>>> escaping wrong.  Using tcsh:
>>>
>>> <10:01am>beast/gallatin:work1>git clean -ne '\!\*.orig'
>>> Would remove ktrace.out
>>> <10:01am>beast/gallatin:work1>git clean -xn | grep rej
>>> Would remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej
>>
>> -e expects a pattern of files/directories that you don't want to 
>> remove and can be used multiple times.  It worked here on a testing repo:
>>
>> sh-3.2$ git clean -xn
>> Would remove d1/d2/bar.orig
>> Would remove d1/d2/bar.rej
>> Would remove foo.orig
>> Would remove foo.rej
>>
>> sh-3.2$ git clean -xn -e '*.rej'
>> Would remove d1/d2/bar.orig
>> Would remove foo.orig
>>
>> sh-3.2$ git clean -xn -e '*.rej' -e '*.orig'
>> sh-3.2$
>>
> 
> Fat finger here, I was about to say you also can specify what you want 
> to remove using wildcards like:
> 
> sh-3.2$ git clean -xn '*.orig'
> Would remove d1/d2/bar.orig
> Would remove foo.orig
> 
> sh-3.2$ git clean -xn '*.rej'
> Would remove d1/d2/bar.rej
> Would remove foo.rej
> 

And last but not least, if it does what you need, you can create an 
alias to make it simpler:

sh-3.2$ git config --global alias.myclean "clean -xn '*.rej' '*.orig'"
sh-3.2$ git myclean
Would remove d1/d2/bar.orig
Would remove d1/d2/bar.rej
Would remove foo.orig
Would remove foo.rej

-- 
Renato Botelho



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0a83179a-6bcc-a6e6-7719-28c7b5f2aac1>