I just finished working on a piece of code and when I went to push the changes, I got the already famous:
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
I've seen this question posted several times here, e.g. (1) and (2).
Accordingly, the solution is to either:
git pull
, so that the remote changes are merged on to my local work, orgit push -f
, a force push to update the remote (origin) branch.
Now, it has been a while since I've worked on this branch. I don't necessarily want to merge the remote changes onto my current work! Nor do I know if I can safely force the update on the origin branch...
How can I just see the differences and decide which is best for my case?
git push -f
discards all progress done to the remote repository by other people, unless it is your personal repository you probably do not want it.