Conflicts
Resolving several files at once
5 min read
In a large merge it's common to have dozens of conflicted files where you already know which side stays: generated files, translations, lockfiles, a whole folder the other branch rewrote. Opening them one by one in the conflict editor would be slow. Resolve several… resolves all the checked files at once, each one in full with the chosen side's version, and shows first what will happen to each file.
- Changes panel › header of the Conflicted section: the Resolve several… button ("Resolve several conflicted files at once with one side"). The button appears when there are two or more conflicted files.
- Menu of a conflicted file (right-click): Resolve several conflicted files….
- Palette (Ctrl+P): "Resolve several conflicted files…". With no conflict, the command appears unavailable: "there are no conflicted files".
- Open the Resolve several conflicted files window. It explains: "The checked files take the chosen side's version in full; the other side's changes to those files are discarded."
- In Keep, choose the side. Each option shows the real name and the role, for example "the current version — main (the branch you're on)" or "the incoming version — feature/login (what's being merged into your branch)". The option checked by default is the incoming version.
- In the list, check the files. All of them come checked (except submodules); the All (12) box checks and unchecks all of them at once.
- Check, next to each file, what will happen to it with the chosen side (table below).
- Click the confirm button, which says how many files will be resolved and how many deleted, for example Resolve 12 files (2 deleted).
- The notice confirms it: "12 files resolved with the incoming version. 2 were deleted." The files leave the Conflicted section and go to the stage.
- Resolve the ones left out in the editor and, with the section empty, click Continue on the operation bar.
| What the list shows | When | Result |
|---|---|---|
| takes this version | The chosen side has the file | The file takes that side's version in full and goes to the stage. |
| is deleted (doesn't exist on that side) | The chosen side doesn't have the file (it was deleted or moved there) | The file is deleted and the deletion goes to the stage. |
| submodule: resolve it separately | The conflict is in a submodule | The file can't be checked and stays as it is. Resolve it in the terminal. |
This applies to every kind of conflict: in a "modified on one side, deleted on the other" conflict, choosing the side that modified it keeps the file; choosing the side that deleted it deletes it. Binary files and files too large for the editor are also resolved in full with the chosen side.
| Option | What it does | Default |
|---|---|---|
| Keep | The side that applies to all the checked files | The incoming version |
| Each file's checkbox | Includes the file in the resolution or removes it | All checked, except submodules |
| All (N) | Checks or unchecks all of them | Checked |
There are three git calls in total, no matter how many files:
git checkout --theirs -- locales/en.json locales/es.json # --ours for the current version
git add -- locales/en.json locales/es.json
git rm -f -q -- locales/fr.json # the ones the chosen side doesn't have
It's the same as Use the current version… or Use the incoming version… file by file.
The window warns: "Ctrl+Z undoes this resolution (all files at once). A resolved file can also be reopened in Resolved, in the changes panel."
- All at once: Ctrl+Z ("Undo: Resolution of 12 conflicted files (Ctrl+Z)") puts all the files of that resolution back in conflict, as they were before: in the stage, with the conflicting versions; on disk, with what they contained. The deleted ones come back to disk. Ctrl+Shift+Z redoes it.
- A single file: in the Resolved (n) section of the changes panel, click Reopen on the file. It goes back to conflict and the conflict editor opens on it; from there, Start over goes back to git's markers. See Reopen an already resolved file.
The resolution's Ctrl+Z applies while the operation stays stopped. When it ends, undo becomes that of the whole operation (see Operations stopped halfway). To give up on everything, Abort on the operation bar takes the repository back to before the merge, rebase, cherry-pick or revert.
Caution
In a rebase, the current version is the target branch and the incoming version is your commit. "Keeping the current version" in a rebase discards your changes in those files. Check the name shown next to each option before confirming.
- The real names of the sides come from one of the conflicted files. While they're read, the options appear only as "the current version" and "the incoming version".
- A file that stopped being conflicted between opening the window and confirming is skipped.
- If the conflict editor was open on one of the resolved files, it closes.
For git, a conflict is resolved when the file goes to the stage. If you resolved the file in another program (a code editor, the merge tool from the terminal), just mark it as resolved in Versora.
- Conflicted section: each file's + button ("Mark as resolved (stage)").
- Menu of the conflicted file: Mark as resolved (stage).
- Shortcut: S, with the file selected in the Conflicted section.
- Stage all changes (header of the Unstaged files section, Ctrl+Shift+S, palette) also stages the conflicted files. The button works even when there are only conflicted files.
- Check that the file no longer has the
<<<<<<<,=======and>>>>>>>markers. - Click the file's + in the Conflicted section.
- The file goes to Staged files.
git add -- src/pedido.ts
Ctrl+Z ("Undo: Stage of 1 conflicted file (Ctrl+Z)") puts the file back in conflict. With Stage all changes, the step is "Stage of 3 conflicted files" and all of them come back together. You can also reopen a single file in Resolved (see above).
- Files still have conflict markers: before the stage, the app checks the conflicted files. If any still has markers, it asks first: "src/pedido.ts still has conflict markers (<<<<<<<). Staging marks the conflict as resolved with the markers inside the file. Stage all changes anyway?". Cancel and resolve the file, or confirm Stage anyway if the markers are intentional content.
- The check is the same on every path: the +, Mark as resolved (stage), S, Stage all changes, Ctrl+Shift+S and Ctrl+Shift+Enter. A file without markers (resolved in another program) goes straight to the stage.
- Unstage all changes during a merge doesn't end the merge: only the stage goes back to HEAD. See Operations stopped halfway.
- Files on the "don't commit" list are left out of Stage all changes. See "Don't commit" list.