删除Github提交历史 [英] Delete Github commit history

查看:105
本文介绍了删除Github提交历史的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何,我有删除我的github提交历史吗?我不想失去所有的提交,只是最后10个被推送给github的提交。我似乎无法弄清楚如何做到这一点。

解决方案

只需选择您想要回到并在您的克隆中执行的哈希即可:

  git reset --hard hash#
git push -f原始分支

其中分支是要推送的分支的名称。瞧。小心推动力量。您可能需要复制您的工作目录,直到您熟悉它为止。


Is there anyway for me to delete my github commit history? I don't want to lose all my commits, just the last 10 or so that were pushed to github. I can't seem to figure out how to do this.

解决方案

Just pick the hash you want to go back to and in your clone do:

git reset --hard hash# 
git push -f origin branch

where branch is the name of the branch you want to push. Voilà. Be carefully with the force push. You may want to copy your working directory until you are familiar with it.

这篇关于删除Github提交历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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