简体   繁体   中英

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)

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

Do check it out, it will clear all your doubts!

Here is your answer: git push -f

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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