Skip to content

Instantly share code, notes, and snippets.

@zigarn
Created October 30, 2014 21:14
Show Gist options
  • Save zigarn/20fe5fa89c8e0dd57a20 to your computer and use it in GitHub Desktop.
Save zigarn/20fe5fa89c8e0dd57a20 to your computer and use it in GitHub Desktop.
#!/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'" > /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 !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment