# 删除GitHub中的所有提交历史记录
删除.git文件夹可能会导致git存储库中的问题。如果要删除所有提交历史记录,但将代码保持在当前状态,可以按照以下方式安全地执行此操作:
尝试 运行 git checkout --orphan latest_branch
添加所有文件git add -A
提交更改git commit -am "commit message"
删除分支git branch -D master
将当前分支重命名git branch -m master
最后,强制更新存储库。git push -f origin master
Command line instructions
You can also upload existing files from your computer using the instructions below.
Git global setup
git config --global user.name "lrz"
git config --global user.email "1414556676@qq.com"
Create a new repository
git clone ssh://git@47.103.218.34:9922/msgroup/faq.git
cd faq
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Push an existing folder
cd existing_folder
git init
git remote add origin ssh://git@47.103.218.34:9922/msgroup/faq.git
git add .
git commit -m "Initial commit"
git push -u origin master
Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://git@47.103.218.34:9922/msgroup/faq.git
git push -u origin --all
git push -u origin --tags
//多账户
git init
git add .
git commit -m "init"
git remote add origin https://github.com/Dushusir/lwa.git
git remote set-url origin https://Dushusir@github.com/Dushusir/lwa.git
git config --local credential.helper store
git push -u origin master