当我从PowerShell脚本调用git时,当我运行更复杂的命令时,我开始遇到问题:
# Work fine
git log
# Gives error
git log `git describe --tags --abbrev=0 HEAD^`..HEAD --oneline --count
错误:
fatal: ambiguous argument 'git': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
从PowerShell调用这些长命令时是否有一种很好的方法来封装这些长命令?
答案 0 :(得分:2)
您可以使用createEtchedBorder()
在字符串中执行替换以使其生效。
$()
反引号字符在PowerShell中用作转义字符,就像在Unix shell中使用反斜杠一样。