我有两个分支:no-users
和old-state
。我在本地no-users
。我退出old-state
并解决了合并冲突。现在,我想推送old-state
覆盖该分支上的所有内容并传输新文件,但是强制push(git push -f origin old-state
)某种程度上不能推送在no-users
分支中创建的文件。Git
写的是强制推送已成功运行,但是远程文件不存在。
当你做了
git push -f origin old-state
您将提交推送到了远程old-state
,自合并old-state
到以来就没有改变no-users
,相反,相反。这就是为什么强制在这里没有改变的原因。您的推送没有被拒绝,它只是发送了一个远程已有的引用。
此时只有no-users
树的两部分,所以您最好的选择是
git checkout old-state
# if you're not sure whether you're up-to-date on this branch,
# you might as well do it now before the merge
git pull
git merge no-users
这样您就可以无力地推动:
git push origin old-state
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句