Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit() {
- sleep 1
- git commit -m "$1" >/dev/null
- git log -n 1 --pretty="Committed: %H ($(git branch --show-current)) %s"
- }
- modify() {
- mv $1 $1.copy
- cat $1.copy | sed -e "$2s/.*/$3/" > $1
- rm $1.copy
- git add .
- commit "Modified line $2 of $1."
- }
- dummy_commits() {
- touch dummy.txt
- git add .
- commit "Added dummy.txt"
- git rm dummy.txt >/dev/null
- commit "Removed dummy.txt"
- }
- repo="$(mktemp -d)"
- echo "Created git repository at $repo"
- cd "$repo"
- git init &>/dev/null
- cat >foo.txt <<HERE
- This is line 1
- This is line 2
- This is line 3
- This is line 4
- This is line 5
- This is line 6
- This is line 7
- This is line 8
- This is line 9
- This is line 10
- HERE
- git add .
- commit "Initial commit"
- git checkout -b workbench 2>/dev/null
- mv foo.txt bar.txt
- git add .
- commit "Renamed foo.txt to bar.txt"
- modify bar.txt 3 "Modified bar"
- dummy_commits
- git checkout master 2>/dev/null
- mv foo.txt baz.txt
- git add .
- commit "Renamed foo.txt to baz.txt"
- modify baz.txt 8 "Modified baz"
- dummy_commits
- git merge workbench -m "Merging workbench (conflicts)" >/dev/null
- rm baz.txt
- mv bar.txt foo-merged.txt
- git add .
- commit "Merged bar.txt and baz.txt as foo-merged.txt"
- # ----- Output Stats ------ #
- echo "----------------------------------------"
- git log --raw --follow -m --pretty=format:%H%n%P%n%aL%n%cs%n%s -- foo-merged.txt
- echo "----------------------------------------"
- git blame -elfwM --root --date=short foo-merged.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement