Mercurial Notes (2)

This is from my colleague Esteban:

When you are working with Mercurial, it may help you understand that the work you are doing in your local repository is being done on your own personal branch (an unnamed branch).

In the meantime, other people continue making changes to the original branch on the master repository.

When you try to synchronize your repository with the master you discover that your branch has diverged from the main branch (as it happens if somebody pushes changes before you).

The best strategy to get back in sync with the master repository is to move all your work in your personal branch, to the top of the history (the top of the current history in the master repository).

Mercurial and the Eclipse plugin let you do this with a command called "rebase".

Steps to synchronize your committed changes with the master repository:
  1. pull and update to the latest version
  2. rebase
  • select the first change you committed in your personal branch
  • select the current tip of the branch you are working with
  • resolve any conflicts
  • commit
     3. push your changes to the server

Why do you get two heads after pulling from the master repository?






















Rebasing: