Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I properly force a Git push?
    text
    copied!<p>I've set up a remote non-bare "main" repo and cloned it to my computer. I made some local changes, updated my local repository, and pushed the changes back to my remote repo. Things were fine up to that point.</p> <p>Now, I had to change something in the remote repo. Then I changed something in my local repo. I realized that the change to the remote repo was not needed. So I tried to <code>git push</code> from my local repo to my remote repo, but I got an error like:</p> <blockquote> <p>To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of <code>git push --help</code> for details.</p> </blockquote> <p>I thought that probably a</p> <pre><code>git push --force </code></pre> <p>would force my local copy to push changes to the remote one and make it the same. <strong>It does force the update</strong>, but when I go back to the remote repo and make a commit, I notice that the files contain outdated changes (ones that the main remote repo previously had).</p> <p>As I mentioned in the <a href="https://stackoverflow.com/questions/5509543/how-do-i-properly-force-a-git-push#comment6275726_5509588">comments to one of the answers</a>:</p> <blockquote> <p>[I] tried forcing, but when going back to master server to save the changes, i get outdated staging. Thus, when i commit the repositories are not the same. And when i try to use git push again, i get the same error.</p> </blockquote> <p>How can I fix this issue?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload