| 44 | |
| 45 | If your branch diverged from the mainline (i.e. somebody pushed to the main repository since you branched off), you cannot push anymore. You must merge the two branches. With merging, the order of arguments is significant. You must always ''merge your branch into the mainline'', never the other way around! How can you do this? With bazaar you can only merge to a local repository (you need to chdir into it), you cannot merge to a remote repository. |
| 46 | |
| 47 | Therefore we have to resort to a little trick. Suppose your branch {{{my_branch}}} diverged from the mainline. We thus create a new branch {{{head_clone}}} which will be a clone of the mainline: |
| 48 | |
| 49 | {{{ |
| 50 | $ bzr branch bzr://bzr.helenos.org/head head_clone |
| 51 | }}} |
| 52 | |
| 53 | Now go to the clone repository and merge your branch into it: |
| 54 | |
| 55 | {{{ |
| 56 | $ cd head_clone |
| 57 | head_clone$ bzr merge ../my_branch |
| 58 | }}} |
| 59 | |
| 60 | Now we can push from the clone to the main repository: |
| 61 | |
| 62 | {{{ |
| 63 | head_clone$ bzr push bzr+http://jermar@bzr.helenos.org/head |
| 64 | }}} |
| 65 | |
| 66 | Finally let us sync our branch with the main repository: |
| 67 | |
| 68 | {{{ |
| 69 | head_clone$ cd ../my_branch |
| 70 | my_branch$ bzr pull |
| 71 | }}} |