Git commits always rejected when pushing commit with file added from other branch <p>I have two branches that diverge more than they should.</p> <p>Since this has been marked as duplicate, let me clarify my question.</p> <p>I already know that I can just do <code>git push -f</code> to force the merge. That's what I've done already several times. My question is more about the inner workings of git. If I add a new file to my branch B, I can commit it and push it without any problem. But if I <code>git checkout branch-A somefile.txt</code> and then <code>git add</code> and <code>git push</code>, I get the error below. <strong>Why does this kind of commit seem to always result in that error when pushing?</strong></p> <p>End edit.</p> <hr> <p>To reconcile them to a common ancestor, I have to copy some files from one branch to the other. These are files that should actually have been there but got lost somehow in the process. Every time I do that using <code>git checkout branch-A somefile.txt</code>, commit, and push, the origin gives me this error:</p> <blockquote> <p>"Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote branches before pushing again."</p> </blockquote> <p>Why is that?</p> <p>More detail, if needed: The two branches diverged before we started using git. Now I'm trying to sew them together. I am making sure both branches are correct and all files are identical that <em>should</em> be, so that I can then create a merge point that actually makes sense. They are each a branch of the same repo. In finding their common point of ancestry, I've noticed some files that should have been on both branches are missing from one or the other ( probably the result of some mistake I made when putting them under git). To fix that, I simply <code>git checkout branch-A missingfile.txt</code> into branch B, <code>git add</code>, <code>git commit</code>, and <code>git push</code>. But for some reason every time I push, I get the "out of date" error and have to do a force push. Which is fine if I know I only changed one file, but if I've changed/copied a bunch, then I always have to double check to make sure there isn't some error.</p>