关于java:清空github仓库而不是删除重新创建

明天因为想清空github仓库从新来过,起初不晓得怎么解决,于是上网找了材料,顺便发个博文

— Remove the history from

(从中删除历史记录)

rm -rf .git

— recreate the repos from the current content only

(仅从以后内容从新创立存储库)

git init
git add .
git commit -m “Initial commit”

— push to the github remote repos ensuring you overwrite history

(推送到你的近程仓库,以确保笼罩您的历史记录)

git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
git push -u –force origin master

起源: https://gist.github.com/stephenhardy/5470814

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理