Support via Liberapay

Org-Merge-Driver Example Usage

Here are some examples of the usage of org-merge-driver. When there is a conflict, local updates are shown on the top, and remote updates on the bottom.

1. Adding and Removing Headings

When local and remote files add headings, org-merge-driver combines the information as best it can. If local and remote add the same in the same place, org-merge-driver will add them as the same heading.

1.1. Ancestor

* Basket
** Green Apple
*** Seed 1
** Red Apple
*** Seed 1

1.2. Local

** Green Apple
*** Seed 1
*** Seed 2
** Red Apple
*** Seed 1
** Yellow Apple
*** Seed 1

1.3. Remote

* Basket
** Green Apple
*** Seed 2
** Red Apple
*** Seed 1
*** Seed 2
** Yellow Apple
*** Seed 1

1.4. Output

* Basket
** Green Apple
*** Seed 2
** Red Apple
*** Seed 1
*** Seed 2
** Yellow Apple
*** Seed 1

2. Modifying Text

Text blocks have more conservative rules for what will conflict than headings. Notably, if text is added to the same spot from local and remote, there will be a conflict.

2.1. Ancestor

* Produce
,- the farmers market is famous for their produce.

2.2. Local

#+TITLE: Farmers Market
* Produce
,- They are open on weekends
,- the farmers market is famous for their produce.
,- Its too bad I HATE vegetables

2.3. Remote

* Produce
,- the farmers market is famous for their produce.
,- Its a good thing I love vegetables
,  - Snow Peas are the best.
* Pies
,- also they have a lot of pies

2.4. Output

#+TITLE: Farmers Market
* Produce
,- They are open on weekends
,- the farmers market is famous for their produce.
,>>>>>>> Updated
,- Its too bad I HATE vegetables
,======= 
,- Its a good thing I love vegetables
,  - Snow Peas are the best.
,<<<<<<< Updated
* Pies
,- also they have a lot of pies

3. Headline Matching

In general, org-merge-driver will try to ignore white space and cookie values when determining if two headings are the same one. This works great as long as you do not identify headings by the amount of spaces in the name, or the value of a priority cookie. Dates can still be used as identifiers, though.

3.1. Ancestor

* Todo state updates
** Updated in one file
** Updated in both files
** Same update in both files
* Cookies
** Updated in one file
** Updated in both files
** Same update in both file
* Tags
** Updated in one file                                               :oldtag:
** Updated in both files                                      :oldtag:keeper:
** Same update in both files                                         :keeper:
* Other Examples
** Spacing    doesn't     matter
** spacingkindofmatters
** Cookies   [5/3]   are   [75%] stripped [#A]  out

3.2. Local

* Todo state updates
** TODO Updated in one file
** DONE Updated in both files
** TODO Same update in both files
* Cookies
** [#B] Updated in one file
** [#C] Updated in both files
** [#B] Same update in both file
* Tags
** Updated in one file                                       :NEWTAG:NEWTAG2:
** Updated in both files                                      :NewTag:keeper:
** Same update in both file                                      :SameNewTag:
* Other Examples
** Spacing        doesn't         matter
** spacing[#B]kindofmatters
** Cookies are stripped out

3.3. Remote

* Todo state updates
** Updated in one file
** TODO Updated in both files
** TODO Same update in both files
* Cookies
** Updated in one file
** [#A] Updated in both files
** [#B] Same update in both file
* Tags
** Updated in one file
** Updated in both files                                       :file2:keeper:
** Same update in both file                                      :SameNewTag:
* Other Examples
** Spacing                   doesn't           matter
** spacing kindofmatters
** Cookies   [5/3]   are   [75%] stripped [#A]  out

3.4. Output

* Todo state updates
** TODO Updated in one file
,>>>>>>> Updated
** DONE Updated in both files
,======= 
** TODO Updated in both files
,<<<<<<< Updated
** TODO Same update in both files
* Cookies
** [#B] Updated in one file
,>>>>>>> Updated
** [#C] Updated in both files
,======= 
** [#A] Updated in both files
,<<<<<<< Updated
** [#B] Same update in both file
* Tags
** Updated in one file                                       :NEWTAG:NEWTAG2:
** Updated in both files                                :keeper:file2:NewTag:
** Same update in both file                                      :SameNewTag:
* Other Examples
,>>>>>>> Updated
** Spacing        doesn't         matter
,======= 
** Spacing                   doesn't           matter
,<<<<<<< Updated
** spacing kindofmatters
,>>>>>>> Updated
** spacing[#B]kindofmatters
,======= 
,<<<<<<< Deleted
** Cookies are stripped out

4. Properties

Properties have special support when it comes to matching, as well as conflict resolution. Properties must be inside :PROPERTIES: to be identified as such.

4.1. Ancestor

* Picnic Basket
,:PROPERTIES:
,   :Bread: Brown
,:Apple:     green
,   :Basket: wicker
,:END:

4.2. Local

* Picnic Basket
,:PROPERTIES:
, :Bread: White
, :Apple:    yellow
, :Basket:             wicker
,:END:

4.3. Remote

* Picnic Basket
,:PROPERTIES:
,:Bread:    white
,:Apple:  red
,:Basket:     plastic
,:END:

4.4. Output

* Picnic Basket
,:PROPERTIES:
,>>>>>>> Updated
, :Bread: White
,======= 
,:Bread:    white
,<<<<<<< Updated
,>>>>>>> Updated
, :Apple:    yellow
,======= 
,:Apple:  red
,<<<<<<< Updated
,:Basket:     plastic
,:END:

5. Heading Movement

If your headings have unique ID properties, org-merge-driver can detect movements of those elements.

5.1. Ancestor

* Changing the order of headings
** heading 1
,:PROPERTIES:
,:ID: 1
,:END:
** heading 2
,:PROPERTIES:
,:ID: 2
,:END:
*** sub heading
,- some text
** heading 3
,:PROPERTIES:
,:ID: 3
,:END:
** heading 4
,:PROPERTIES:
,:ID: 4
,:END:
* Moving Children and Parent
* Deleting the 'moved to' heading

5.2. Local

* Matching ID Headings
* Changing the order of headings
** heading 4
,:PROPERTIES:
,:ID: 4
,:END:
* Moving Children and Parent
** new heading
*** heading 2
,:PROPERTIES:
,:ID: 2
,:END:
**** sub heading
,- some text
,- a new line in local
* Deleting the 'moved to' heading
** heading 3
,:PROPERTIES:
,:ID: 3
,:END:
*** heading 1
,:PROPERTIES:
,:ID: 1
,:END:

5.3. Remote

* Matching ID Headings
* Changing the order of headings
** heading 1
,:PROPERTIES:
,:ID: 1
,:END:
** heading 2
,:PROPERTIES:
,:ID: 2
,:END:
,- some new text in remote
** heading 3
,:PROPERTIES:
,:ID: 3
,:END:
** heading 4
,:PROPERTIES:
,:ID: 4
,:END:
* Moving Children and Parent

5.4. Output

* Matching ID Headings
* Changing the order of headings
,>>>>>>> Deleted
,======= 
** heading 2
,- some new text in remote
,<<<<<<< Updated
** heading 4
,:PROPERTIES:
,:ID: 4
,:END:
* Moving Children and Parent
** new heading
*** heading 2
,:PROPERTIES:
,:ID: 2
,:END:
**** sub heading
,- some text
,- a new line in local
,>>>>>>> Updated
* Deleting the 'moved to' heading
** heading 3
,:PROPERTIES:
,:ID: 3
,:END:
*** heading 1
,:PROPERTIES:
,:ID: 1
,:END:
,======= 
,<<<<<<< Deleted

If you have any comments or suggestions for features, improvements, or bugs, please drop an email to me <youngar at gmail dot com>, or to the org-mode list <emacs-orgmode@gnu.org>.

Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.