git-svn rebase走了可怕的错误 [英] git-svn rebase gone horribly wrong

查看:144
本文介绍了git-svn rebase走了可怕的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法重做git-svn rebase。或重置它的任何效果。

在我的+8000提交git-svn仓库中,合并分支后出现问题。我的本地主没有反映任何附近的干线完整日志。



正确运行 git svn rebase >获取新的版本,但是然后尝试应用从svn trunk中看起来全部8000+的提交。



有没有方法可以重新设置并确保master的HEAD指向HEAD的问题?

解决方案

在术语中存在一些混淆:HEAD与head 或小费。 HEAD指的是当前签出的分支。



无论如何。 :)

如果你真的想丢掉你所做的一切,并把你的主人归还给主干的副本,那很简单。假设主人签出:

  git reset --hard trunk 

警告:重置--hard会销毁未提交的更改。 想要对先前的工作做出先进的拯救,让我给你一个非常非常简短的介绍git的众多安全带之一:reflog。例如,如果你说

  git log -g master 

您会看到一份主人的保存点列表。我们称之为git land的reflog。每当一个操作改变一个分支时,它就在该分支的reflog的顶部预先添加一个新的保存点。换句话说,如果最后一个操作让你的分支变得糟糕透顶,那么你可以将你的分支返回到该操作之前的那个分支:

  git reset --hard master @ {1} 

一旦你看到一个reflog,@ {1} 会更有意义。 git还支持更多华丽的语法,如 @ {10.minutes.ago}



,但这应该足以让事情现在得到解决。


Is there a way to redo a git-svn rebase. or reset any effects by it.

In my +8000 commit git-svn repository, something went wrong after merging a branch. My local "master" does not reflect anything near a complete log of trunk.

And running git svn rebase correctly fetches new revisions but then tries to apply what looks like all 8000+ commits from the svn trunk.

Are there ways to reset and make sure the HEAD of master points to HEAD of trunk?

解决方案

There is a little bit of confusion in the terms: "HEAD" is not the same thing as "head" or "tip". "HEAD" refers to the currently checked out branch.

Anyway. :)

If you really want to throw away everything you've done and return your master to an exact copy of trunk, that's very simple. Assuming that master is checked out:

git reset --hard trunk

Warning: reset --hard destroys uncommitted changes.

If you want to do advanced salvation of previous work, let me give you a very, very brief introduction to one of git's numerous safety belts: the reflog. For example, if you say

git log -g master

you'll see a list of, well, "savepoints" for master. We call this the reflog in git land. Whenever an operation changes a branch, it prepends a new savepoint to the top of that branch's reflog. In other words, if the last operation you did horribly messed up your branch, you can return your branch to what it was immediately before that operation:

git reset --hard master@{1}

That @{1} will make more sense once you look at a reflog. git also supports more flashy syntax, like @{10.minutes.ago}.

Many more things are possible, but this should be enough to get things fixed up for now.

这篇关于git-svn rebase走了可怕的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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