git grep doesn't accept -- to separate branch from filename -
i have both file , branch called atlas, trips git when want search in using git grep:
$ git grep asdf atlas -- fatal: ambiguous argument 'atlas': both revision , filename use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]' $ git grep asdf atlas -- . fatal: ambiguous argument 'atlas': both revision , filename use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]'
with git log, can append --
fix it:
$ git log -1 --oneline atlas fatal: ambiguous argument 'atlas': both revision , filename use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]' $ git log -1 --oneline atlas -- 690eca5 atlas: unit tests
how achieve same result git grep
?
edit: clarify: want search asdf
in every file in branch called atlas.
try this:
git grep asdf atlas:
the colon used specifying refspec format <source>:<destination>
, can leave destination empty , provide source, in case makes clear referring branch , not file.
you can learn more refspecs here.
Comments
Post a Comment