Skip to content

Commit 4491734

Browse files
committed
Merge branch 'kh/merge-tree-doc'
Docfix. * kh/merge-tree-doc: doc: merge-tree: improve example script
2 parents 6fe1b8c + c4b8fb6 commit 4491734

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)