Home  >  Q&A  >  body text

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

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

某草草某草草2727 days ago1043

reply all(2)I'll reply

  • PHP中文网

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

    Looks like a mistake because your adjacent commits are all the same.

    If you want to restore, first you need to go back to before merge commit, that is, 18c7602 之前。另一方面,你在 merge commit 之后还有提交,所以直接用 git revert should be able to solve it.

    git revert 18c7602 -m 1

    Try it. If something goes wrong, you can use the reflog function to undo the local operation. It should be safe


    In brief explanation, -m 1 的意思就是,选取 18c7602 之前的一个 commit(也就是你截图中的 2bb3800) serves as parent. In this commit, the content in the purple branch cannot be read. So I think it should be possible to do this

    reply
    0
  • 世界只因有你

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

    Delete the branch and it will be gone

    git branch -d branchname

    reply
    0
  • Cancelreply