我们的远程主分支弄乱了。当前的开发代码与最新的提交均在master分支上。显然,开发代码尚未准备好用于master分支。
因此,在我的本地存储库中,我将其重置为最新标签git reset --hard (Tag)。现在,我的本地存储库上的master分支是正确的。现在,当我尝试将更改推送到远程存储库时,git push origin master出现错误:
To (REMOTE GIT REPOSITORY LOCATION)
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '(REMOTE GIT REPOSITORY LOCATION)'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
因此,环顾四周后,我发现了该--force选项。因此,我强行推送到远程存储库,git push --force origin master但仍然出现错误:
Total 0 (delta 0), reused 0 (delta 0)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To (REMOTE GIT REPOSITORY LOCATION)
! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '(REMOTE GIT REPOSITORY LOCATION)'
我无法对master进行处理,因为它包含不能在master上的开发代码。
denyNonFastforwards = true。我将其更改为false,推送了更改,然后将其更改为true。再次感谢大家的帮助。
