git创建仓库提交代码
创建一个仓库后
# Git global setup
git config --global user.name "独书先生"
git config --global user.email "1414556676@qq.com"
# Create a new repository
git clone ssh://git@github.com/DuShuSir/openSource.git
cd jystaticft
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@github.com/DuShuSir/openSource.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@github.com/DuShuSir/openSource.git
git push -u origin --all
git push -u origin --tags
删除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
设置本地多账户
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
详细理解多账户:
git tag 打标签
在commit之后
git tag -a release-v0.0.0 -m "内容"
git push origin release-v0.0.0
git 撤销 add commit 操作:
git reset HEAD .
参考
https://appsoftea.com/zh/git-init-repository-push-code/