git - 如何抑制 git 消息:致命:此操作必须在工作树中运行
问题描述
当我在 git repo 中运行cd .git && git status
git 时,只会显示:
fatal: this operation must be run in a work tree
.
有没有办法抑制这个错误信息?
另一种情况是在 Zsh 中启用 vcs 后autoload -Uz vcs_info
,如果您在.git
目录中,则每个命令都会收到此错误消息。
解决方案
发现git 社区提供的 git/git-prompt.sh可以使用它。
推荐阅读
- javascript - javascript数组中的深度过滤对象
- javascript - 使用 AJAX 查询。PHP(代码点火器)
- laravel - CoreUI Vue 模板与 Laravel 的集成
- javascript - 在浏览器的每个页面上运行我的 Javascript 代码,类似于 chrome 扩展的方式
- pyspark - Py4JJavaError:调用 o27.sessionState 时出错
- android - 底页滚动问题
- javascript - js循环中的第一个进度条不更新
- reactjs - 使用 Reducer 从 Store in Array 中移除产品,移除错误的项目
- json - 用`jq`对一个不适合内存的大文件进行`sort_by`的最佳方法是什么
- c++ - 使用 lambda 函数的两组花括号?