How do you get a lost “autostash” commit from `git rebase --autostash`

前端 未结 2 977
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 07:27

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

But in case the re

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 08:19

    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.

提交回复
热议问题