Git Rebase似乎有效,但所有提交仍在日志中显示......我处于什么状态? [英] Git Rebase seems to have worked but all commits are still showing in the log... what state am I in?

查看:1222
本文介绍了Git Rebase似乎有效,但所有提交仍在日志中显示......我处于什么状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我用rebase压缩了最后的40次提交。
我按照这个指南来确保我没有做任何愚蠢的事情 - http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html



问题是,我认为我做了一些愚蠢的事。



(交互式)文本文件无法保存,所以看起来rebase失败了,但是它的消息不知道我在哪里或是在做什么(甚至是我的名字)。
这是我做的:


  • 我输入git rebase -i HEAD〜40

  • 我编辑了一个文本文件,通过将所有行改为以'squash'开头,除了最上面的一行

  • 我在windows上使用EditPad ...文件可以不会被保存! Oh noes ...(只读/权限?)。

  • 我将它保存到一个随机目录中。

  • 命令行显示某种成功(不幸的是我已经失去了信息)。我不知道它是如何成功的,或者知道我保存的文件在哪里...

  • git rebase --continue saysNo rebase progress in? git reflog表明它起作用了(从我至少知道的'rebase'这个词在最后的40次提交中显示)例如:

    >

    9992445 HEAD @ {8}:rebase:报告工作

  • 但运行 git log 显示所有40次提交我刚刚'重新发布'



这看起来不太好。 'm in?
我是否陷入僵局,这是僵尸吗?

解决方案

如果rebasetodo list

最简单的方法来压缩这么多的提交将做 git reset - -soft HEAD〜40 然后 git commit 加上你的新消息 - 假设你想压扁所有这些消息。


I think I squashed the last 40 commits using rebase. I was following this guide to make sure I didn't do anything stupid - http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

The problem is, I think I did something stupid.

The (interactive) text file couldn't be saved, so it seems that the rebase failed but the message it gave and some other things below suggest it might have worked.

Not sure where I am or what to do (or even what my name is). Here's what I did:

  • I typed git rebase -i HEAD~40
  • A text file came up, which I edited, by changing all lines to start with 'squash' except the top one
  • I'm on windows, using EditPad... the file can't be saved! Oh noes... (read-only/permissions?).
  • I save it to a random directory.
  • The command line shows some sort of success (unfortunately I've lost the message). I don't know how it could succeed or know where the file I saved is...

  • git rebase --continue says "No rebase in progress?

  • git reflog suggests it worked (from what I know at least, the word 'rebase' is showing on the last 40 odd commits) eg:

    9992445 HEAD@{8}: rebase: reports working

  • but running git log shows all 40 commits I just 'rebased'

This isn't looking good. Does anyone know what state I'm in? Am I in limbo, was this a zombie rebase?

解决方案

If the rebase "todo list" couldn't be saved, your rebase didn't work.

The easiest way to squash that many commits would be to do git reset --soft HEAD~40 and then git commit with your new message - assuming you want to squash all of them.

这篇关于Git Rebase似乎有效,但所有提交仍在日志中显示......我处于什么状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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