search

Home  >  Q&A  >  body text

git-gui - How to delete a baseline on git

As shown in the picture, it is a baseline in sourcetree. The entire baseline code was created by my mistake. How can I delete this baseline?

某草草某草草2768 days ago1088

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