git - How to clear the result of a command? -
so, imagine result of cmd: git l | tail -n 1 | awk '{print $3}’ hash 709bc16
when run cmd:
git show --pretty="format:" --name-only $(git l | tail -n 1 | awk '{print $3}’)
i error
fatal: ambiguous argument '709bc16': unknown revision or path not in working tree. use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>…]’
when try directly git show --pretty="format:" 709bc16
then cmd executed successfully.
i don't know ask. believe format of result of cmd: $(git l | tail -n 1 | awk '{print $3}’)
based on diagnosis in comments of invisible characters surrounding revision shortname, git l command alias of "porcelain" (ui) git command, not "plumbing" (shell script) command.
porcelain commands more user-friendly on command line, using color, indentation, , ascii art display repository. however, exact output isn't specified, , subject change , evolution across versions. plumbing commands low-level commands exactly-specified plaintext outputs designed cases shell scripting.
you may want scan git man page relevant plumbing commands git rev-list.
Comments
Post a Comment