问题描述
我运行这个命令
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 status
步骤:
命令:
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.
解决方法
最终找到问题的根本原因。
在网络目录中运行 git filter-branch
似乎不是那么健壮。我将文件复制到本地机器,并且可以成功运行 git filter-branch
命令。