git/list[1] front-page[2] threads[3] people[4] search[5] about
 

script for reproducing history example in git-log(1) man page

From
Adam Spiers <git@adamspiers.org>
Date
Dec 19, 2013, 18:36 UTC
Message-ID
<20131219183645.GD23496@pacific.linksys.moosehall>

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?

Next: Adam Spiers
Message 1 of 14 in “script for reproducing history example in git-log(1) man page”
  1. Adam SpiersDec 19, 2013
  2. questions / suggestions about history simplificationAdam Spiers, Dec 19, 2013
  3. Jonathan NiederDec 19, 2013
  4. Adam SpiersDec 19, 2013
  5. Junio C HamanoDec 19, 2013
  6. Adam SpiersDec 19, 2013
  7. Junio C HamanoDec 19, 2013
  8. Adam SpiersDec 19, 2013
  9. Junio C HamanoDec 19, 2013
  10. Adam SpiersDec 19, 2013
  11. Junio C HamanoDec 22, 2013
  12. Adam SpiersDec 22, 2013
  13. Junio C HamanoDec 26, 2013
  14. Adam SpiersDec 19, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.