问题记录 git 想要删掉master commit提交记录/ 回退master 提交记录
假设你想要保留当前的工作,但是要删除master分支的所有commit记录
首先,找到你想要重置到的commit的哈希值,或者使用HEAD~1来回退一个commit
git log
# 使用这个命令查看commit历史,找到你想要回退到的commit的哈希值
然后,使用git reset命令重置master分支
git reset --hard <commit-hash>
最后,强制推送到远程仓库
git push origin master --force