Skip to content

Commit fd78021

Browse files
committed
Merge branch 'kh/merge-tree-doc' into maint-2.47
Docfix. cf. <CABPp-BE=JfoZp19Va-1oF60ADBUibGDwDkFX-Zytx7A3uJ__gg@mail.gmail.com> * kh/merge-tree-doc: doc: merge-tree: improve example script
2 parents bd8a8a7 + c4b8fb6 commit fd78021

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Documentation/git-merge-tree.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,15 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],
211211
linkgit:git-update-ref[1], and linkgit:git-mktag[1]. Thus, it can be
212212
used as a part of a series of steps such as:
213213

214-
NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)
215-
test $? -eq 0 || die "There were conflicts..."
216-
NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)
214+
vi message.txt
215+
BRANCH1=refs/heads/test
216+
BRANCH2=main
217+
NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {
218+
echo "There were conflicts..." 1>&2
219+
exit 1
220+
}
221+
NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \
222+
-p $BRANCH1 -p $BRANCH2)
217223
git update-ref $BRANCH1 $NEWCOMMIT
218224

219225
Note that when the exit status is non-zero, `NEWTREE` in this sequence

0 commit comments

Comments
 (0)