Merge two checkouts of a dataset into a single checkout. Uses [knead](http://github.com/karissa/knead) as default merge tool for now.
Merges two forks.
```
dat merge <versionA> <versionB>
dat merge <forkA> <forkB>
```
####Options
`--merge-tool`: run the given merge tool to assist in resolving conflicts manually.
`-` for <file>: receive resolved changes on stdin
-`-` for <file>: receive resolved changes on stdin
-`left`: pick the left side as the winner
-`right`: pick the right side as the winner
-`yolo`: pick random side for each key
####Resolutions from file
Example output:
A `dat merge` receives a stream of changes that will be applied to resolve conflicts between two versions.
$ dat merge
Merging from a file:
```
$ cat resolutions.json | dat merge ab3234dfe5 bdc3ae23cef -
$ dat merge resolutions.json
Changes resolved successfully.
Current version is now b04adb64fdf2203
```
####Merge tools
Merging as a stream using `dat diff`:
```
$ dat merge ab3234dfe5 bdc3ae23cef --merge-tool="my-merge-tool.sh"
$ dat diff ab3234dfe5 bdc3ae23cef | <tool> | dat merge -
Changes resolved successfully.
Current version is now b04adb64fdf2203
Current version is now 98v8catb4bvcddf
```
In this example, the `<merge-function/tool>` decides which change to keep between the versions suppled in a `dat diff`, outputting the json for each kept change to stdout.
Merging two forks by picking one side:
```
$ dat diff ab3234dfe5 bdc3ae23cef | <merge-function/tool> | dat merge ab3234dfe5 bdc3ae23cef -
$ dat mergeab3234dfe5 bdc3ae23cef --left
Changes resolved successfully.
Current version is now b04adb64fdf2203
Current version is now b2bg304823h32h2
```
##dataset commands
@@ -342,8 +367,9 @@ cat file.json | dat import -
###Options
-`key` - specify which field to use as the primary key
-`key`/`k` - specify which field to use as the primary key
-`no-key` - generate a random unique key
-`message`/`m` - a short description of this import
Example output:
@@ -438,3 +464,25 @@ Example output:
$ dat get uw60748112
{"key":"uw60748112","version":"5abd6625cd2e64a116628a9a306de2fbd73a05ea5905e26d5d4e58e077be2203","value":{"time":"2014-04-30T00:09:37.000Z","latitude":"46.7557","longitude":"-121.9855","place":"24km ESE of Eatonville, Washington","type":"earthquake"}}
0 comments on commit
03d35b7