1我尝试了你提到的方法:git push origin a03c048ce8497adda985921a979b4d1d8d74d01:master,结果出现了以下错误信息:! [rejected] 8a03c048ce8497adda985921a979b4d1d8d74d01 -> master (non-fast-forward)
error: failed to push some refs to 'https://belotte@bitbucket.org/belotte/my-new-site.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details. - belotte
git reset HEAD~1
来“撤销”最后一次提交,但仍保留文件更改。你可能需要先执行git branch backupBranch
,这样你就还有原始提交记录。 - Aasmund Eldhusetgit pull
如果您希望为此分支设置跟踪信息,可以使用以下命令:git branch --set-upstream master origin/
- belotte