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