Step 1: remove all history
rm -rf .git
Step 2: reconstruct the Git repo with only the current content
git init
git add .
git commit -m "Initial commit"
Step 3: push to GitHub.
git remote add origin <github-uri>
git push -u --force origin master
Others:
Existing folder or Git repository
cd existing_folder
git init
git remote add origin <github-uri>
git add .
git commit
git push -u origin master
Create a new repository
git clone <github-uri>
cd cavi_web
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
清除Git历史记录并重新推送
本文介绍了一种方法来清除Git仓库的历史记录,并重新构建仅包含当前文件内容的新仓库,最后将这些更改推送到GitHub上。此外还提供了如何创建新仓库及在现有文件夹中初始化Git仓库的步骤。
2104

被折叠的 条评论
为什么被折叠?



