Home  >  Q&A  >  body text

github 如何清空某一branch的commits

是这样的,我为某一个repo建了一个github page,也就是多出一个分支gh-pages。我是用的github网页版的automatic generator生成的gh-pages。

每次我更新gh-pages都会往gh-pages这个branch里commit东西。问题是这些历史记录对我没用,我担心commit太多了占地方而且看着不舒服。

有没有什么办法将这个分支的历史记录全部抹去?

高洛峰高洛峰2697 days ago575

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-02 09:27:25

    Delete this branch and create a new branch with the same name

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:27:25

    Commit cannot be deleted. Even if you delete the branch, the commit record will not be deleted, so you cannot erase all branch history.
    Of course, if you just want to make the branch look prettier, you can consider using git rebaseto compress the commit and then force push the branch

    reply
    0
  • Cancelreply