File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -eufo pipefail
3+ IFS=$' \t '
4+
5+ # https://github.com/tj/git-extras/issues/1234
6+ # try to manually resolve merge conflicts (if any)
7+ # in unmerged ("both modified" `status`) files;
8+ # works with any WD inside work-tree;
9+
10+ # shellcheck disable=SC2046
11+ # ignore files outside WD, to avoid overload
12+ git diff --name-only --diff-filter=U --relative -z |
13+ while IFS= read -r -d ' ' f; do
14+ if ! git diff --check -- " $f " ; then
15+ printf ' %s\0' " $f "
16+ fi
17+ done |
18+ xargs -0r $( git var GIT_EDITOR)
19+
20+ # user might have removed other conflict-markers,
21+ # so check full WT
22+ git diff --name-only --diff-filter=U -z |
23+ while IFS= read -r -d ' ' f; do
24+ # WARN: `f` is relative to repo root!
25+ # this might be broken
26+ if git diff --check -- " $f " ; then
27+ git add -- " $f "
28+ fi
29+ done
30+
31+ git continue
You can’t perform that action at this time.
0 commit comments