git - 使用 --grep-reflog 有什么好处?

标签 git git-reflog

我在文档中注意到您可以指定参数 --grep-reflog

--grep-reflog=<pattern>

Limit the commits output to ones with reflog entries that match the specified pattern (regular expression). With more than one --grep-reflog, commits whose reflog message matches any of the given patterns are chosen. It is an error to use this option unless --walk-reflogs is in use.

我有点想澄清这与 --grep 有何不同。查看通过 git reflog 执行的操作有什么好处?只是为了让您知道 git reflog 中可用的内容,所以如果您想访问它,您可以吗?

最佳答案

--grep 仅搜索适用于可从分支头访问的提交。您将使用 --grep-reflog 来搜索可从 reflog 条目访问的提交,否则可能无法从现有分支访问这些提交。我认为这主要用于错误恢复(找到丢失的提交以便您可以恢复它)。

关于git - 使用 --grep-reflog 有什么好处?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29524375/

相关文章:

Git SVN 错误 : a Git process crashed in the repository earlier

git pull 总是导致 merge

将 core.logAllRefUpdates 设置为 true 的裸存储库中的 git reflog 不返回任何内容

php - 通过 HTTPS 使用具有私有(private) GitHub 存储库的 Composer

git - 无法通过SSH连接到GitHub(但是可以连接到GitLab)

java - Eclipse - 外部 JAR 和 git

git - 恢复被 git pull 覆盖的更改

git checkout 上一条

git - 搞砸了主 git 分支......无法弄清楚我需要恢复什么