Git:如何重置远程Git存储库以删除所有提交? [英] Git: How to reset a remote Git repository to remove all commits?
本文介绍了Git:如何重置远程Git存储库以删除所有提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何重置远程和本地Git存储库以删除所有提交?
How can I reset a remote and local Git repository to remove all commits?
我想从当前的Head重新开始作为初始提交.
I would like to start fresh with the current Head as the initial commit.
推荐答案
完全重置?
-
在本地删除
.git
目录.
重新创建git repostory:
Recreate the git repostory:
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
推送到远程服务器,覆盖.记住,这样做会把其他人搞砸了……您最好是唯一的客户.
Push to remote server, overwriting. Remember you're going to mess everyone else up doing this … you better be the only client.
$ git remote add origin <url>
$ git push --force --set-upstream origin master
这篇关于Git:如何重置远程Git存储库以删除所有提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文