Conflict detection, prevention & handling
HighFlux detects code conflicts between your work and your team. For members of your team who use HighFlux, the detection is immediate.
For other members, HighFlux detects conflicts only when they push their work to the git hosting service (GitHub, GitLab, etc…)
Conflict prevention
Conflict prevention has two components to it.
- Keeping your work up-to-date with trunk regularly.
- Detecting and alerting whenever you and a teammate start conflicting changes.
Keeping your work up-to-date with trunk
Automatically
By default, HighFlux pulls changes every 6 hours:
- It retrieves the latest changes on trunk from the remote repo
- It applies those changes to all of your WIPs If the trunk now contains work that conflicts with your changes, the UI (and CLI) will indicate so.
Manually
You can PULL the latest changes into a specific WIP manually:
hf pull
Or
hf pull all
to pull the changes into all your WIPs. Or through the UI by clicking either "PULL ALL" or "PULL" on the WIP details page.
Detecting and alerting on conflicting changes
You'll get a desktop notification when HighFlux detects your work will conflict with other team members.
HighFlux will display the conflicting code in its UI.
You can use the CLI as well:
hf conflicts show
In the UI
Each WIP that has conflicts is clearly marked with an orange icon:
You can also see which WIPs TX-5
conflicts with by clicking any of the conflicting WIPs or git branches:
In any WIP that contains conflicts, the PULL button will turn orange and the “show conflicts” button will appear:
You can click on the button to see the conflicts between your work and the other team member’s work.
HighFlux currently uses 3-way conflict markers to show conflicts:
Each conflict is composed of three sections, separated by special markers.
The first section shows the other team members’ work and appears between the <<<<<<< HEAD
and |||||||||
markers.
The second section shows the lines as they were before the other team member and you changed them. Its marked by |||||||
and =======
.
The third and last section shows your changes to the same lines and starts at ======
and ends at >>>>>>>
.
Resolving conflicts with trunk
Resolving conflicts between your work and changes on trunk is done by “writing the conflicts” into your files, and then resolving them. When HighFlux writes conflicts, the markers described above will appear into your files, indicating where your changes and the ones on Trunk conflict.
You can then go into each file and edit it to keep only the “merged” change - i.e. the actual change you want the file to contain, and delete the conflict markers.
To write conflicts to your files, you can either use the CLI:
hf pull —write-conflicts
Or using the UI, by clicking the orange PULL button, and then answering OK:
If everyone on your team uses HighFlux, your chances of having conflicts with trunk are reduced dramatically. Most of the conflicts are handled, or discussed in a very early stage. From our experience, this prevents merges from hell from occurring and only allows agreed-on, pre-known simple conflicts.