Git development
 help / color / mirror / Atom feed
From: Adam Spiers <git@adamspiers.org>
To: git mailing list <git@vger.kernel.org>
Subject: script for reproducing history example in git-log(1) man page
Date: Thu, 19 Dec 2013 18:36:45 +0000	[thread overview]
Message-ID: <20131219183645.GD23496@pacific.linksys.moosehall> (raw)

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?

             reply	other threads:[~2013-12-19 18:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 18:36 Adam Spiers [this message]
2013-12-19 19:03 ` questions / suggestions about history simplification Adam Spiers
2013-12-19 19:10   ` Jonathan Nieder
2013-12-19 20:38     ` Adam Spiers
2013-12-19 20:20   ` Junio C Hamano
2013-12-19 20:36     ` Adam Spiers
2013-12-19 20:39       ` Junio C Hamano
2013-12-19 20:46         ` Adam Spiers
2013-12-19 20:37   ` Junio C Hamano
2013-12-19 20:58     ` Adam Spiers
2013-12-22  6:44       ` Junio C Hamano
2013-12-22 13:41         ` Adam Spiers
2013-12-26  9:56           ` Junio C Hamano
2013-12-19 21:04   ` Adam Spiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131219183645.GD23496@pacific.linksys.moosehall \
    --to=git@adamspiers.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox