我是GitHub的新手(我坚持添加,提交和推送,并且没有使用新的分支机构),今天正在尝试推动一些更改。但是,我提交了一些文件,并意识到自己搞砸了,并试图通过运行以下命令取消提交:
git reset --mixed HEAD~;
我尝试了几次推动和重置。我不确定自己做了什么,但是在检查git status时我就到这里了:
Your branch and 'origin/master' have diverged,
and have 1 and 2 different commits each, respectively.
当我尝试推动时,它指出:
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
所以我想我现在落后了很多,因为最近两次提交已经跟踪了一些文件,或者git status现在说是未跟踪的。此外,我不想失去在本地计算机上取得的任何进步。在理想的情况下,如何才能快速推进并推动要进行的更改,而又不丢失任何过去的提交或当前的进度?