3-way-merge¶
vb 3-way-merge BASELINE V1 V2 [MERGED]
Description¶
Inputs are files BASELINE, V1, and V2. The file MERGED is generated as output. If no MERGED file is specified, output is sent to stdout.
BASELINE is a common ancestor of two files V1 and V2 that have diverging edits. The generated output file MERGED is the combination of all changes in both V1 and V2.
This command has no effect on the VisionByte repository. It is a utility command made available for the convenience of users. This command can be used, for example, to help import changes from an upstream project.
Suppose an upstream project has a file named Xup.c which is imported
with modifications to the local project as Xlocal.c. Suppose further
that the Xbase.c is an exact copy of the last imported Xup.c.
Then to import the latest Xup.c while preserving all the local changes:
vb 3-way-merge Xbase.c Xlocal.c Xup.c Xlocal.c
cp Xup.c Xbase.c
# Verify that everything still works
vb commit
Examples¶
Init and open a repository
$ vb init merge3_repo.vbyte
project-id: f93c38a2583e814404bd5bad96e7fd504fb1fe08
server-id: 355dc2ba4213da36e49f05ec34a4d271b06b41ad
admin-user: ubuntu (initial remote-access password is "WQdPE84vLj")
$ vb open -f merge3_repo.vbyte
project-name: <unnamed>
repository: /tmp/sphinx_tests/164a5b5c/merge3_repo/merge3_repo.vbyte
local-root: /tmp/sphinx_tests/164a5b5c/merge3_repo/
config-db: /tmp/sphinx_tests/164a5b5c/.visionbyte
project-code: f93c38a2583e814404bd5bad96e7fd504fb1fe08
checkout: 324cd0c29f90d67d17e9c802fadfda3289b9abb6 2026-03-31 12:59:58 UTC
tags: trunk
comment: initial empty check-in (user: ubuntu)
check-ins: 1
Prepare three file versions [base, version A, version B]
$ vb sys echo -e "start\nline 1\nline 2" > base
$ vb sys echo -e "start\nline 1 test merge\nline 2" > version_a
$ vb sys echo -e "start\nline 1\nline 2 new line" > version_b
$ vb 3-way-merge base version_a version_b result
Show the merged result
$ vb sys cat result
start
line 1 test merge
line 2 new line