Re: git locate
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Jun 2, 2010, 11:29 UTC
- Message-ID
- <AANLkTinBwk_l-prWXHiAE8UoSMaJMebHm5Y7J8TOScYR@mail.gmail.com>
- In-Reply-To
- <AANLkTil38OLw3J6ZPvv2wNu98QuTXJKtNwRZP0NDZPWn@mail.gmail.com>
On Wed, Jun 2, 2010 at 12:02 PM, John Tapsell <johnflux@gmail.com> wrote:
Show 24 quoted lines
> On 2 June 2010 14:00, John Tapsell <johnflux@gmail.com> wrote: >> On 15 February 2010 22:20, Sverre Rabbelier <srabbelier@gmail.com> wrote: >>> Heya, >>> >>> On Thu, Jan 21, 2010 at 01:11, SungHyun Nam <goweol@gmail.com> wrote: >>>> The alias 'git locate' and the command 'git ls-files' runs >>>> differently if I run them in a subdirectory. >>>> Is it expected? >>> >>> I just ran into this (I wanted to alias 'git find' but to me the 'run >>> ls-files from cwd' is desirable. Also, I prefer to have a trailing >>> glob as well, so I added one :). An easy solution is to drop >>> 'git-find' in your path somewhere: >> >> I have finally settled on: >> >> [alias] >> locate = !sh -c 'git ls-files | grep --color=auto "$1"' - > > > Actually could someone help me with this.. the trouble is that this > returns paths relative to the root. > > Can I get it to find all the files, but relative to where I am now?
Make it a git command, not an alias. You'll then be fine. put git-locate somewhere in your $PATH
--<-- #!/bin/sh git ls-files | grep --color=auto "$1" --<--
Of course you need to chmod u+x for it.
-- Duy