git - 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
命令。
推荐阅读
- firebase - 在初始化时读取用户的最佳方式
- ruby - 在 Postgres 中将带有 UTC 的时间戳转换为毫秒
- node.js - nodejs从会话中删除变量
- javascript - 如何从 JavaScript 中的 Set 中删除对象
- mysql - 无法重新启动 mysql(有关详细信息,请参阅“systemctl status mysql.service”和“journalctl -xe”。)
- jquery - 从 jquery-1.11.1.js 迁移到 jquery-1.12.4.js
- google-chrome-extension - 如何在不打开空选项卡的情况下从扩展程序启动自定义 URI?
- spring-boot - 使用 JpaRepository 将 protobuf 直接保存为实体
- php - 使用 ajax 序列化文件(图像)并插入查询
- c# - 在数据网格上插入 PersianDate 时出错:无法评估表达式,因为当前线程处于堆栈溢出状态