【问题标题】:git log specific file with pretty formatgit log 具有漂亮格式的特定文件
【发布时间】:2021-02-28 02:16:56
【问题描述】:

我不明白如何修复 cmd 或 powershell

git log myfile.txt --pretty=format:'%Cblue%h%Creset - %s%Creset' -n 10

当我收到此错误时

fatal: option '--pretty=format:%Cblue%h%Creset - %s%Creset' must come before non-option arguments

更新:myfile.txt 不是输出文件:它是我想要 GIT HISTORY 的源文件

【问题讨论】:

  • 我可能是错的,但是,我认为 git 做了一个改变,-- 必须在命令的末尾。你试过git log myfile.txt -n 10 --pretty=format:'%Cblue%h%Creset - %s%Creset' 吗?
  • 您还有同样的问题吗?还是将-- 刷到命令帮助的末尾?
  • @Zak 刚试过你的建议仍然出错:致命:选项'-n'必须在非选项参数之前
  • 试试git log --pretty=format:'%Cblue%h%Creset - %s%Creset' -n 10 > myfile.txt

标签: git powershell cmd


【解决方案1】:

我相信您的选择与日志文件本身混淆了...您正在尝试写入自定义日志文件。日志文件需要放在最后并使用>“写入”。

git log --pretty=format:'%Cblue%h%Creset - %s%Creset' -n 10 > myfile.txt

我通常喜欢使用.log 格式将它们称为“日志”文件。但这只是偏好。

git log --pretty=format:'%Cblue%h%Creset - %s%Creset' -n 10 > my_git_log.log

更新

当采购历史 - 应该仍然在最后.. IE

git log --all -- /path/to/file/myfile.txt

【讨论】:

  • myfile.txt 不是输出文件:它是我想要 GIT HISTORY 的源文件
猜你喜欢
  • 2017-06-30
  • 1970-01-01
  • 2021-03-30
  • 1970-01-01
  • 2013-03-05
  • 2020-09-15
  • 2019-07-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多