6

Git from the Bottom Up John Wiegley 建议全天运行一个 cronjob,调用 git stash,然后调用 git stash apply。我很欣赏每小时(甚至更频繁地)对我的工作进行快照的想法,但我担心如果文件暂时消失或恢复到 HEAD,构建可能会中断。有没有另一种方法来实现目标,而不会冒这个风险?

4

2 回答 2

4

您可以执行以下操作:

git branch -f autosave $(git stash create)

这将强制分支autosave更新为新更新的存储对象。git stash create保存但不会触及您的索引和工作树。您可以依靠 reflogautosave来查找以前的版本,就像 stash 一样。

于 2012-06-20T17:29:08.153 回答
0
git update-ref refs/stash $(git stash create)

这将创建一个存储(它可以像所有其他存储一样被引用和保存),而无需修改工作目录或索引。

来源

于 2012-06-20T17:45:02.447 回答