简体   繁体   中英

How to combine xargs with git show --name-only

$ git lg1 --author=name . |awk -F' ' '{print $2}'
8901004
4e4c435
ab9e126

$ git lg1 --author=name . |awk -F' ' '{print $2}'|xargs -I{} git show {} --name-only
fatal: ambiguous argument '8901004': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Question> How should I do here to fix the git complaint?

Note: git lg1 Pretty git branch graphs

This runs just fine in a git 2.28 Windows bash:

MINGW64 /c/git/git (master)
$ git lg -2 --author=name . |awk -F' ' '{print $2}'|grep 8|xargs -I{} git show {} --name-only

I tried with --name-only or git show --name-only {} , without adding any '--' at the end, and it does work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM