top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

GIt-SCRIPT: history example from git-log man page

+13 votes
258 views

I wanted to experiment with TREESAME example, so I built this script which recreates it:

#!/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

Hope it would be useful?

posted Dec 20, 2013 by anonymous

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button

...