我正在尝试将我的主分支推送到我的生产分支。
通常,当我在 Ubuntu 计算机上进行更改时,我会通过以下方式推送到 master:
git add .
git commit -m "message"
git push
一切正常。然后我简单地做:
git push origin master:production
一切正常。但现在由于某种原因,当我在终端中执行“git push origin master:生产”时,我收到消息:
To <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="87e0eef3c7e0eef3eff2e5a9e4e8ea" rel="noreferrer noopener nofollow">[email protected]</a>:Username1/myapp.git
! [rejected] master -> production (non-fast-forward)
error: failed to push some refs to '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb8b6ab9fb8b6abb7aabdf1bcb0b2" rel="noreferrer noopener nofollow">[email protected]</a>:Username1/myapp.git'
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.
mypc@ubuntu:~/myapp$
如何解决这个神秘出现的恼人问题?我尝试了“git pull origin master”,正如消息中和我的研究中其他地方所建议的那样,但我在终端中得到的只是“一切都是最新的”,当我再次尝试时,问题再次出现。谢谢。
最佳答案
有人已经致力于生产分支。
正如@user1281385所说,你应该
git pull origin master:product
或更好,然后以其他方式查看生产分支上的更改。
尝试 git help pull
来阅读更多内容。
关于github 问题 - 错误 : failed to push some refs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17741552/