从失败的变基中恢复
我正在使用 git svn 来通过公司指定的 svn 服务器获得一些 git 的好处。我刚刚有一个变基严重错误,我正在尝试找出恢复的最佳方法。
发生的事情是这样的:
首先,我有这个
<前><代码>---1(主) \--B--C--D--E(功能/修复小部件)然后我做了
<前><代码>---1--2--3--4(主) \--B--C--D--E(功能/修复小部件)git checkout master
,然后在 master 上执行git svn rebase
来拉下这些承诺。我没有预料到我的功能分支和主分支之间会发生任何冲突,因为更改位于完全不同的文件夹中。所以在这一点上,我想我有这个:其中
1--2--3--4
是从svn拉入的提交。接下来我执行
git checkout feature/fix-widgets
,然后执行git rebase master
。冲突立刻就出现了,而且有些事情并不一致,所以我决定溜走,更仔细地审视事情。我执行了 git rebase --abort,希望这能让我恢复到 rebase 之前的状态。我执行
git rebase --abort
并收到以下消息$ git rebase --abort 错误:git checkout-index:无法创建文件 somedir/somefile.cs (权限被拒绝) 致命:无法将索引文件重置为修订版“be44daa05be39f6dd0d602486a598b63b6bd2af7”。
现在我不知道该怎么做。
git status
显示我正在使用feature/fix-widgets
,但我有一大堆暂存的更改,以及大量未跟踪的文件,这些文件是之前提交的。如果我能返回E
就好了。
I'm using git svn
to get some git goodness with the company-mandated svn server. I just had a rebase go horribly awry, and I"m trying to figure out the best way to recover.
Here's what happened:
To start with, I had this
---1 (master) \--B--C--D--E (feature/fix-widgets)
So then I did
git checkout master
and thengit svn rebase
on master to pull down those commits. I did not anticipate any conflicts between my feature branch and the master, because the changes were in a totally different folder. So at this point, I think I have this:---1--2--3--4 (master) \--B--C--D--E (feature/fix-widgets)
Where
1--2--3--4
are commits pulled in from svn.Next I do
git checkout feature/fix-widgets
and thengit rebase master
. There's immediately a conflict, and some things that don't add up, so I decide to slink away and look at things more carefully. I dogit rebase --abort
, hoping this will restore me to where I was before the rebase.I do
git rebase --abort
and receive the following message$ git rebase --abort error: git checkout-index: unable to create file somedir/somefile.cs (Permission denied) fatal: Could not reset index file to revision 'be44daa05be39f6dd0d602486a598b63b6bd2af7'.
Now I'm not sure what to do.
git status
shows that I'm onfeature/fix-widgets
, but I have a whole bunch of staged changed, and a large number of untracked files, which were previously committed. I'd be fine if I could get backE
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该查看
ORIG_HEAD
所以试试这个
git reset
返回到任何 rebase 之前:You should have a look at
ORIG_HEAD
So try this
git reset
to get back to before any rebase: