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

Is there a way to see which differences I'm handling? I'm tempted to do a push -f and first want to see what I'm overwriting. Thanks!

Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
  • 1
    You can never overwrite data with `hg push`. It is an append-only operation which means that you only add more data to the destination repository. – Martin Geisler Dec 30 '10 at 09:58

3 Answers3

3

To see the differences between your local and the remote repository, run hg incoming. Then you can decide if you want to

  1. push your changes anyway and create a new head on the remote side (using push -f),
  2. or if it is better to pull the remote changes first, merge them locally and push the
    merged changes.

The latter one usually is preferable, it depends on how you collaborate with the other developers. Note that if you do a hg pull first, your local changes aren't touched, so you can inspect the remote changes side-by-side with your local ones and you can still decide not to merge and do a hg push -f anyway.

Oben Sonne
  • 9,893
  • 2
  • 40
  • 61
  • I tried the latter whereupon it complained about 3 heads. The differences were only 2 removed files and looks resolved now. Thank you for replying. – Niklas Rosencrantz Dec 18 '10 at 19:54
3

Don't execute push -f, ever :) It will most likely fail but still, don't do it. I learned that the hard way.

The error happens because some has already pushed something to the master repository. What you need to do is pull changes before pushing them. To see what will you get, run hg in or hg incoming (in is an alias of incoming), and afterwards run hg pull -u. See this page for more information on what else you can do.

David Kuridža
  • 7,026
  • 5
  • 26
  • 25
  • Thanks! It reported 2 files removed. I did hg pull and hg merge and then it complained about 3 heads so I did hg push -f having backed up several versions. – Niklas Rosencrantz Dec 18 '10 at 19:46
1

You need to do a pull first. Then a merge. Then a push.

push -f may be dangerous.

To answer your question you can see changes that you made:

hg status

and

hg diff

in your local repository.

hg incoming

shows any changes in the remote repository that you have not yet pulled.

zellus
  • 9,617
  • 5
  • 39
  • 56
Vincent Ramdhanie
  • 102,349
  • 23
  • 137
  • 192
  • Thank you Vincent. It was 2 files removed hg incoming showed was the diff. I finally did a hg push -f since it didn't seem dangerous just having the difference of removed files. – Niklas Rosencrantz Dec 18 '10 at 19:53