aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-11-25 12:29:44 +0900
committerJunio C Hamano <gitster@pobox.com>2024-11-25 12:29:44 +0900
commitfd78021b91902dd85d07bedbd040ea057c6ffeba (patch)
tree4926b914afd13982e3807b79b6a16bb5944d8db2
parentbd8a8a71dcdb343e32e80ae73169ae4f7b213b40 (diff)
parentc4b8fb6ef2114a4df4dc7a0a07233e91a272a29e (diff)
downloadgit-fd78021b91902dd85d07bedbd040ea057c6ffeba.tar.gz
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
-rw-r--r--Documentation/git-merge-tree.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt
index 84cb2edf6d..0b6a8a19b1 100644
--- a/Documentation/git-merge-tree.txt
+++ b/Documentation/git-merge-tree.txt
@@ -211,9 +211,15 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],
linkgit:git-update-ref[1], and linkgit:git-mktag[1]. Thus, it can be
used as a part of a series of steps such as:
- NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)
- test $? -eq 0 || die "There were conflicts..."
- NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)
+ vi message.txt
+ BRANCH1=refs/heads/test
+ BRANCH2=main
+ NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {
+ echo "There were conflicts..." 1>&2
+ exit 1
+ }
+ NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \
+ -p $BRANCH1 -p $BRANCH2)
git update-ref $BRANCH1 $NEWCOMMIT
Note that when the exit status is non-zero, `NEWTREE` in this sequence