Merge Conflicts

bitmap

Use Bit's git driver to better handle merge conflicts when merging .bitmap files. Conflicts often happen when git tries to merge (using a 3-way merge strategy) a .bitmap file from a source branch that does not share a common ancestor with the target branch.

The driver will automatically merge the .bitmap files and mark the merge conflict as resolved.

Run the following command to install the driver in your repository:

$bit
Copiedcopy

The command should generate or update the .git/config and .gitattributes files:

MY-WORKSPACE
.git
.bit
.git/config
config
.bitmap
.bitmap
.gitattributes
.gitattributes
workspace.jsonc
workspace.jsonc

Since the .git/config file is not tracked by git, you will need to run the command in each repository that uses the driver. Alternatively, you can add the driver to your global git config file (~/.gitconfig) by running the following command:

$bit
Copiedcopy

Simulate a merge conflict

Run the following to simulate a merge conflict between two branches with a .bitmap file:

cd my-workspace
bit init
git init
git add .
git commit -am 'commit on main'
git checkout -b first-component
bit create node lit-card
git add .
git commit -am 'first commit of first component'
git checkout main
git checkout -b second-component
bit create node lit-checkbox 
git add .
git commit -am 'second component added' 
git checkout main
git merge first-component
git merge second-component # -> merge conflicts

git reset --hard # reset the merge

bit git set-merge-driver # install the driver
git merge second-component # -> no merge conflicts! 🎉
CopiedCopy