我正在尝试压缩git存储库中的一些提交。
> git rebase -i HEAD~3
Successfully rebased and updated refs/heads/staging.
将打开一个标题为git-rebase-todo的文件:
pick a2f3467 Require statement incorrect
pick c41212e Require file in environment
pick 2743221 This should work
# Rebase c5f42f3..2743221 onto c5f42f3
# ..........我尝试将最后两个提交从pick更改为squash。我保存了该文件,并得到以下错误:
Unable to save ~/Documents/code/myapp/.git/rebase-emrge/git-rebase-todo
发布于 2013-03-15 19:09:55
问题是,当sublimetext2启动时,它不会阻塞并立即返回。然后,Git认为您已经完成了对文件的编辑,并执行rebase。这就是为什么你会看到
Successfully rebased and updated refs/heads/staging消息,在你编辑文件之前。请改用subl命令,该命令就是为此类用途而设计的。github help会告诉您使用以下命令进行配置
git config --global core.editor "subl -n -w"发布于 2018-04-26 08:27:23
根据我的经验,这个问题是由于用户权限造成的。
如果在保存文件时收到Could not find the file "~/../../git-rebase-todo"错误,请尝试以sudo运行该文件:
sudo git rebase -i HEAD~3但是请记住,这可能会更改任何受影响文件的所有者。
发布于 2022-02-03 17:08:53
我在使用vs代码时遇到了类似的问题,你可以在你的终端中尝试一下……
git config --global core.editor "code -n --wait"
https://stackoverflow.com/questions/15384502
复制相似问题