git filter-branch:无法重写分支:您有未暂存的更改

git filter-branch: Cannot rewrite branches: You have unstaged changes

我运行这个命令

git filter-branch -f --tree-filter "echo AAAAAAA" --prune-empty --tag-name-filter cat -- --all

并得到如下错误

Proceeding with filter-branch...

Cannot rewrite branches: You have unstaged changes.

以前,我运行

git stash
git stash drop

运行宁

git status

给我看

Refresh index: 100% (107206/107206), done.
On branch master

It took 8.70 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
nothing to commit, working tree clean

git还希望我做什么?


更新:正在尝试 git 状态

步数:

命令:

git stash 

输出

No local changes to save

命令:

git stash drop

输出

No stash entries found.

命令:

git status

输出

Refresh index: 100% (107206/107206), done.
On branch master
It took 8.39 seconds to enumerate untracked files. 'status -uno'

may speed it up, but you have to be careful not to forget to add

new files yourself (see 'git help status').

nothing to commit, working tree clean

命令:

git filter-branch -f --tree-filter "echo AAAAAAA" --prune-empty --tag-name-filter cat -- --all

输出

WARNING: git-filter-branch has a glut of gotchas generating mangled history

     rewrites.  Hit Ctrl-C before proceeding to abort, then use an

     alternative filtering tool such as 'git filter-repo'

     (https://github.com/newren/git-filter-repo/) instead.  See the

     filter-branch manual page for more details; to squelch this warning,

     set FILTER_BRANCH_SQUELCH_WARNING=1.

Proceeding with filter-branch...
Cannot rewrite branches: You have unstaged changes.

最终找到问题根源。

网络目录中的 运行ning git filter-branch 似乎不是那么健壮。我将文件复制到本地机器并可以成功执行 运行 git filter-branch 命令。