gpt4 book ai didi

git - 中止 rebase 后如何应用自动存储?

转载 作者:行者123 更新时间:2023-12-05 01:02:04 27 4
gpt4 key购买 nike

我在 .gitconfig 中将 rebase.autoStash 设置为 'true',这样我就可以运行 rebase 在脏工作树上。但是,如果 rebase 由于某种原因中止,则对跟踪文件的所有更改都将消失(即不会重新应用自动存储)。在这种情况下应用自动存储的正确方法是什么?

如何重现:

  • 运行 git config rebase.autostash true
  • 编辑一些跟踪文件。
  • 运行 git rebase -i HEAD^^^。这会打印如下内容:

    Created autostash: 75a5188
    HEAD is now at f0c93f1 WIP
  • 中止 rebase ,例如让编辑器退出并显示错误代码(Vim 中的 :cq)。

最佳答案

您可以使用 git stash applygit rebase 打印的 SHA-1 哈希来应用 autostash:

$ git rebase -i HEAD^^^
Created autostash: 3ac3f4a
HEAD is now at f0c93f1 WIP
# abort the rebase...
$ git stash apply 3ac3f4a
On branch master
...

关于git - 中止 rebase 后如何应用自动存储?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37252108/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com