我在尝试将一个项目推送到GIT时遇到了以下问题。
推送时,我收到了以下错误消息:
$ git push origin master
To https://bitbucket.org/MyAccount/my-project.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://MyAccount@bitbucket.org/MyAccount/my-projec.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
看起来,如果我做出了错误的断言,请纠正我,我的远程存储库中有一些变更,我没有在本地存储库中获取到它们,并且建议我执行拉取以获取这些变更。
对我来说,这是一个问题,因为本地版本是我的应用程序的最后一个确定版本,我不能冒险覆盖它,从远程存储库中获取旧的或错误的内容(或由他人制作的内容)。
我可以指定推送本地内容而不考虑远程更改吗?或者我如何检查我最后一次本地提交和远程内容之间的差异?