Push creates new remote heads! (did you forget to merge? use push -f to force)

Mercurial

Mercurial Problem Overview


Ok I've had a little google and can't find a solution as i've stumbled across the same message but different ways in which people have got it. I'm new to mecurial and want to make sure i'm doing this correctly.

So i'm getting the error message as above. I have a dev site and a live site and i'm trying to push the code to codebase.

However yesterday I accidentally did hg add which added all the media which i didn't want to do. I did revert after to remove all the media files from codebase, by then committing and push the changes. So today i've been making changes to the CSS file and a few templates. I've gone to commit my changes and push them but when i run hg push I get the error above.

I've run hg log and there are only 6 commits as it's a clean/new branch/project. Any help would be much appreciated and I apologize if i've not explained anything correctly!

Mercurial Solutions


Solution 1 - Mercurial

This isn't an "error" message; it's a totally normal situation. That message is saying "hey, other people pushed new work to that repository while you were doing your work, you should probably integrate theirs into your so they don't have to integrate yours into theirs?"

So first do a:

hg pull

and then a:

hg merge

Incidentally the revert you did if you actually used the hg revert command didn't remove those files from history, so your history is probably pretty big.

Consider reading the first few chapters of the Mercurial book it covers these situations quite well.

Solution 2 - Mercurial

If you want to cancel your conflicting changes

hg outgoing

You should see lines containing your commited/conflicting changes which are not pushed. Search for the changeset revision. Here 64

searching for changes
changeset:   64:1830948c246e

Then

hg strip 64

Solution 3 - Mercurial

This worked for me.

hg push -f

For more command, try

hg help push

Solution 4 - Mercurial

On TortoiseHg you can do this:

1 => Commit your files

2 => Go do your new branch, where you want to push your code

3 => On this branch, run Merge with develop

4 => Push your code whithout errors!

Solution 5 - Mercurial

If you are using the Workbench to push the changes you can try the Detect outgoing changes first, See the attached Image

enter image description here

This will give you info on what is you are going to push. My issue was, i had an old draft pending to be pushed. I was able to continue with the push once i have done strip on the old draft.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJDaviesView Question on Stackoverflow
Solution 1 - MercurialRy4an BraseView Answer on Stackoverflow
Solution 2 - MercurialWoodyView Answer on Stackoverflow
Solution 3 - MercurialChristine TuazonView Answer on Stackoverflow
Solution 4 - MercurialKamil NajaView Answer on Stackoverflow
Solution 5 - MercurialAkbar BadhushaView Answer on Stackoverflow