#!/bin/sh
git init --q repo
cd repo
python -c "import random; print '\n'.join([' '.join([word.replace('\n', '') for word in random.sample(list(open('/usr/share/dict/words')), 10)]) for _ in range(50)])" >> file
git add file
git commit -qm "Initial commit"

sed -i '15s/[eiouy]/a/' file
git commit -aqm "Change line 15 on master"

git checkout -qb branch HEAD~
sed -i '25s/[eiouy]/a/' file
git commit -aqm "Change line 25 on branch"
sed -i '15s/[eiouy]/a/' file
git commit -aqm "Change line 15 on branch"

git merge -q master -m "Merge branch 'master' into 'branch'"
echo "Full log:"
git log --graph --oneline --all --decorate --name-status
echo "---"
echo "Log of 'file':"
git log --graph --oneline --all --decorate --name-status -- file

git reset -q --hard HEAD^
git checkout -q master
git merge -q branch -m "Merge branch 'branch' into 'master'" > /dev/null
echo "---"
echo "Full log:"
git log --graph --oneline --all --decorate --name-status
echo "---"
echo "Log of 'file':"
git log --graph --oneline --all --decorate --name-status -- file
# ==> No history from master !
