设置远程仓库
$ git remote -v
$ git remote set-url origin REMOTE_URL
GitHub Fork 的项目如何更新源项目更新?
$ git remote add upstream REMOTE_URL
# 1
$ git fetch upstream
$ git merge upstream/master
# or 2
$ git pull upstream main
提交信息写错了怎么办?
$ git commit --amend --only
$ git commit --amend --only -m 'xxx'
提交时用了错误的用户名或邮箱?(单次)
$ git commit --amend --no-edit --author "USER_NAME <USER_EMAIL>"
最后一次提交不想要了?
# 已 push
$ git reset HEAD^ --hard
$ git push --force-with-lease [remote] [branch]
# 未 push
$ git reset --soft HEAD@{1}