你如何获得丢失的“自动静止”从`git rebase --autostash`提交 [英] How do you get a lost "autostash" commit from `git rebase --autostash`

查看:887
本文介绍了你如何获得丢失的“自动静止”从`git rebase --autostash`提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 git rebase --autostash 时,git会自动创建一个autostash提交,并在重新绑定成功后重新应用它。



但是如果rebasing被中止(例如在Vim中使用:cq ,当它是一个交互式rebase时),autostash-commit可能会结束作为一个悬而未决的提交。



Git 2.9.0

解决方案

Git 2.10(Q3 2016)应该完全避免这个问题。



请参阅 commit 33ba9c6 (2016年6月29日)作者: Patrick Steinhardt( pks -t

(由 gitster - commit 5eb1e9f ,2016年7月13日)


rebase -i :在abort时恢复autostash



当我们中止我们通过调用 die_abort 来完成交互式重新分页,它通过删除rebase状态目录来清理。

如果用户请求使用autostash功能,但状态目录也可能包含对自动存储的引用,该引用现在将被删除。



通过尝试重新应用自动存储在 die_abort 中。
这也将处理自动存储不再适用的情况,通过将其记录在用户可见隐藏。



When using git rebase --autostash, git automatically creates an "autostash" commit, and will re-apply it after a successful rebase.

But in case the rebasing is aborted (e.g. by using :cq in Vim when it's an interactive rebase), the autostash-commit might end up as a dangling commit.

Git 2.9.0

解决方案

Git 2.10 (Q3 2016) should avoid that issue entirely.

See commit 33ba9c6 (29 Jun 2016) by Patrick Steinhardt (pks-t).
(Merged by Junio C Hamano -- gitster -- in commit 5eb1e9f, 13 Jul 2016)

rebase -i: restore autostash on abort

When we abort an interactive rebase we do so by calling die_abort, which cleans up after us by removing the rebase state directory.
If the user has requested to use the autostash feature, though, the state directory may also contain a reference to the autostash, which will now be deleted.

Fix the issue by trying to re-apply the autostash in die_abort.
This will also handle the case where the autostash does not apply cleanly anymore by recording it in a user-visible stash.

这篇关于你如何获得丢失的“自动静止”从`git rebase --autostash`提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆