Thread (14 messages) flat view 14 messages, 8 authors, 2016-06-15

Re: git locate

From: Štěpán Němec <hidden>
Date: 2016-06-15 22:48:04

On Thu, Jan 21, 2010 at 09:11:20AM +0900, SungHyun Nam wrote:
Hello,

Johannes Schindelin wrote:
quoted
On Tue, 19 Jan 2010, Jakub Narebski wrote:
quoted
Johannes Schindelin[off-list ref]  writes:
quoted
On Wed, 20 Jan 2010, John Tapsell wrote:
quoted
  Could we add a:  git locate<filename>        or git find<filename>
How about "git ls-files \*<filename>"?
Or "git ls-files '*filename'...

... but how to make an (git) alias for this?
Add something like this to your $HOME/.gitconfig:

[alias]
        locate = !sh -c 'git ls-files "\\*$1"' -
The alias 'git locate' and the command 'git ls-files' runs
differently if I run them in a subdirectory.
Is it expected?

[master] ~/srcs/git[299]$ git locate urls.txt
Documentation/urls.txt
[master] ~/srcs/git[300]$ git ls-files '*urls.txt'
Documentation/urls.txt
[master] ~/srcs/git[301]$ cd t
[master] ~/srcs/git/t[302]$ git locate urls.txt
Documentation/urls.txt
[master] ~/srcs/git/t[303]$ git ls-files '*urls.txt'
[master] ~/srcs/git/t[304]$
Yeah, as stated in another part of the Wiki page Dscho referred to
(namely the "Serve repo on the spot" section):

"It makes use of the fact that (currently, as of git 1.5.6.1) non-git
alias are executed from the top-level dir of a repo."

("non-git" == those starting with "!", which is the case here)


    Štěpán
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help