简体   繁体   English

强制将分支推送到远程

[英]force push branch to remote

solved edit解决了编辑

what worked for me was:对我有用的是:

git push --force

worked like a charm without having to overcomplicate things using commands that I dont understand.工作就像一个魅力,而不必使用我不理解的命令使事情变得过于复杂。

Thanks a lot for the answers and the downvotes, why??, we will never know.非常感谢您的回答和反对,为什么??,我们永远不会知道。

_.      _
  \(..)/

I am working in a local branch named 'fixes', I made a push so I have some changes on remote, then I realised that sth was missing on the code, made changes and pushed them, surprise when I realised that the remote had work that I did not, so I tried我在一个名为“修复”的本地分支中工作,我进行了推送,所以我在远程进行了一些更改,然后我意识到代码中缺少某些东西,进行更改并推送它们,当我意识到远程有工作时感到惊讶我没有,所以我尝试了

git pull origin fixes

git push 

then I solved one conflict and tried to push again, but the issue still happening.然后我解决了一个冲突并尝试再次推动,但问题仍然存在。

at this point I want to force push my local changes into the remote overwriting them, I have been checking around for the force push command but I am a bit scared of messing things around.此时我想强制将我的本地更改推送到远程覆盖它们,我一直在检查强制推送命令,但我有点害怕把事情搞砸。

what would be the correct git force push command for my situation (overwritting the remote)对于我的情况,正确的 git 强制推送命令是什么(覆盖遥控器)

This will work -这将起作用 -

git push -f <remote> <branch>

If you want a detailed explanation, I found this existing answer -如果您想要详细的解释,我找到了这个现有的答案 -

Force "git push" to overwrite remote files 强制“git push”覆盖远程文件

Do check it out, it will clear all your doubts!去看看吧,它会解决你所有的疑惑!

Here is your answer: git push -f这是你的答案: git push -f

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM