Build1 publisher2 min readPublished
Git 2.56's add --resolved flag stages only the files a merge left in conflict
Git 2.56's git add --resolved stages only conflicted files and refuses to run while conflict markers remain, according to a dev.to walkthrough. Teams that still type git add -u after a merge can drop that habit once every machine they use runs 2.56.
The Engineer · Build desk
Drafted by a language model from the sources cited here and checked against its claim ledger before publication. How we use AISend a correction
What happened
- After a conflict, the habitual git add -u or git add . stages every modified tracked file, including debug edits sitting in unrelated files.
- Before 2.56, the careful option was typing each conflicted path by hand, and nothing checked those files for leftover conflict markers.
- The new command looks only at unmerged paths, the UU, AA and UD entries in git status, and scans each one for conflict markers.
- It cannot be combined with -u or -A, though a path such as config.ini can narrow it to a single file.
- On the walkthrough author's Fedora machine, the system Git was still 2.55 when the post was written.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- decision Contributing guides that tell developers to run git add -u after a conflict need a new line, because the new flag cannot be added onto the old command.
- constraint Reviewers still have to read the full staged diff of every conflicted file; the flag only removes unconflicted files from that job.
- cost A team can depend on the flag only once every laptop and CI runner reports 2.56, and on slower distributions that means installing Git outside the package manager.
The refusal is all-or-nothing. If one conflicted file still has markers, the command stages none of them and prints the files that still need work [8]. I think this is the right default for a merge. A half-resolved conflict cannot reach the index through this command, and the developer gets a list of what is left [8].
The gap it closes is in review. Merge commits get much less review than normal commits, according to the walkthrough's author [5]. "Nobody notices it, because nobody reads merge commits line by line," the author wrote [4]. In the author's example, a `set -x` goes in with a resolution, and a few weeks later someone asks why the start script suddenly prints every command [3].
The command still stages whole files. Tracked files outside the conflict set are never staged [9]. The conflicted files go in whole [1], so a debug print added inside one of them lands in the merge commit with the resolution [1]. The walkthrough does not describe what pattern the marker check [7] matches.
Getting 2.56 onto a machine before the distribution ships it took a config file. The author's mise.toml pins `"conda:git" = "2.56.0"` under `[tools]` and sets `experimental = true` under `[settings]` [12]. The second line is needed because mise still marks its conda backend as experimental [12]. For now, then, the safer way to stage a merge arrives through an experimental installer. The pinned Git applies only inside the project that holds that mise.toml, and the system Git stays as it was [13]. The author recorded every step of the demo in a real terminal on Git 2.56.0 [15].
The same release also changes something scripts can see. `-h` now exits 0 in most commands, where it used to exit 129, so `git status -h` in a script no longer looks like an error [14].
What to watch
- Fedora moving its system Git from 2.55 to 2.56; until then the flag needs a side install such as the mise conda pin.
- The official 2.56 release notes describing what the marker check matches, and how it treats files with lines that resemble conflict markers.
- Merge tools and IDEs wiring their mark-as-resolved action to git add --resolved.