Below is a reconstruction of the incident. While it might appear to be a lot of text, it is actually just a couple of commits, so please don't be scared and read on.
Consider a team of two developers - Leo and Penny - working on a product. The product's repository has two branches: 'default' and 'stable'. New features are being developed on the 'default' branch. Bugs are fixed on the 'stable' branch. From time to time the 'stable' branch is merged back into the 'default'.
hg init repo
cd repo
@echo > product.cs
hg add
hg commit -u leo -m "initial version"
hg branch stable
hg commit -u leo -m "creating 'stable' branch"
cd repo-penny
hg up stable
@echo > bugfix-02.cs
hg add
hg commit -u penny -m "fixed: bug-02"
hg up default
hg merge stable
hg commit -u penny -m "merged bugfixes into the default branch"
@echo > new-feature.cs
hg add
hg commit -u penny -m "new cool feature"
![]() |
Penny's repository: bug fixed, feature implemented. |
pushing to C:\Temp\repo
searching for changes
abort: push creates new remote head 4fa702a0c723 on branch 'stable'!
(you should pull and merge or use push -f to force)
hg pull --rebase
Damage is done!
![]() |
Penny's repository before rebase |
![]() |
Penny's repository after rebase. A code from the development branch is now on the stable branch. |