Heim  >  Fragen und Antworten  >  Hauptteil

git-gui - 如何删除git上的一条基线

如图所示,是sourcetree中的一条基线,这一整条上的基线代码是我误操作搞出来的,请问如何删除这一条基线

某草草某草草2727 Tage vor1051

Antworte allen(2)Ich werde antworten

  • PHP中文网

    PHP中文网2017-05-02 09:53:14

    看起来像是误操作,因为你的相邻 commit 都是一样的。

    如果要恢复,首先你需要退回到 merge commit 之前,也就是 18c7602 之前。另一方面,你在 merge commit 之后还有提交,所以直接用 git revert 应该就可以解决。

    git revert 18c7602 -m 1

    试下吧,如果出现问题还可以用 reflog 功能撤销本地操作。应该是安全的


    简单解释下,-m 1 的意思就是,选取 18c7602 之前的一个 commit(也就是你截图中的 2bb3800) 作为 parent。在这个 commit 中,是读不到紫色那个 branch 中的内容的。所以我觉得应该可以这么搞

    Antwort
    0
  • 世界只因有你

    世界只因有你2017-05-02 09:53:14

    将分支删了就没了

    git branch -d branchname

    Antwort
    0
  • StornierenAntwort