I wanted to be able to experiment with the TREESAME example given in
the git-log(1) man page, so I built this script which recreates it:

--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
#!/bin/bash

mkdir git-log-example
cd git-log-example

git init

# I
echo asdf > foo; echo quux > quux
git add .
git commit -mI; git tag I

# A
echo foo > foo
git add .
git commit -mA; git tag A

# B
git checkout -b b I
echo foo > foo
git add .
git commit -mB; git tag B

# M
git checkout master
git merge --no-commit b
git commit -m"M: merge of A and B"; git tag M

# C
git checkout -b c I
git commit --allow-empty -mC; git tag C

# N
git checkout master
git merge --no-commit c
git commit -m"N: merge of M and C"; git tag N

# D
git checkout -b d I
echo baz > foo
git add .
git commit -mD; git tag D

# O
git checkout master
git merge --no-commit d
echo foobarbaz > foo
git add .
git commit -m"O: merge of N and D"; git tag O

# E
git checkout -b e I
echo xyzzy > quux
git add .
git commit -mE; git tag E

# P
git checkout master
git merge --no-commit e
echo "quux xyzzy" > quux
git add .
git commit -m"P: merge of O and E"; git tag P

# X
git checkout -b x I
rm foo quux; echo side > side
git add -A .
git commit --amend -m"X"; git tag X

# Y
git checkout -b y x
echo side2 > side
git add .
git commit -m"Y"; git tag Y

# Q
git checkout master
git merge --no-commit y
git commit -mQ; git tag Q

# cleanup unneeded branches
git branch -D b c d e x y
--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------

Would it be worth including this in (say) contrib/, and then referring
to it from the man page, in case anyone else feels a similar urge?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to