【发布时间】:2012-12-22 10:50:33
【问题描述】:
我需要从我正在使用的脚本中显示我的存储库的最后一次提交:
git log -1 --pretty=oneline
问题来了:
-
一行打印整个提交哈希,因为要使用这种格式打印。
git log -1 --pretty=format:%h\ %s\ %an但是由于
%符号,批处理文件中的部分代码被识别为变量。 为了完成显示日志,需要发送字符
q,当直接输入到 git bash 时效果很好,但是从批处理文件发送时我得到“'q' is not识别为内部或外部命令”。
【问题讨论】:
-
注意:在 Windows 批处理脚本中,
%%h %%s %%an可以工作。
标签: batch-file git-bash