Git命令使用教程
从命令行创建一个新的仓库
git init
git add .
git commit -m "first commit"
git branch -m master main
git commit --amend
git remote add origin https://github.com/MoGD2018/test.git
git push -u origin master
git push -u origin master -f
git pull origin main
分支操作
git remote update
git fetch
git checkout main
git merge master --allow-unrelated-histories
git status
git branch -a
git push origin --delete master
git branch -d master
git rebase -i HEAD~10
git push -f
错误解决方法
error: pathspec "" did not match any file(s) known to git.
git remote update
git fetch
fatal: refusing to merge unrelated histories
git merge master --allow-unrelated-histories
error: remote origin already exists.
git remote -v
--------
origin https://github.com/MoGD2018/test.git (fetch)
origin https://github.com/MoGD2018/test.git (push)
--------
git remote rm origin
git remote add origin https://github.com/MoGD2018/test.git