如何解决git filter-branch:无法重写分支:您有未暂存的更改
我运行这个命令
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
命令。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。