spacepaste

  1.  
  2. #!/usr/bin/env bash
  3. YELLOW='\033[43;30m'
  4. NORMAL='\033[0m'
  5. status() {
  6. echo -e "$YELLOW$@$NORMAL"
  7. }
  8. cd /tmp
  9. status 'init git repo'
  10. git init tmp_repo
  11. cd tmp_repo
  12. status 'add commit to original repo'
  13. touch foo
  14. git add foo
  15. git commit -m add_foo_file
  16. cd ..
  17. status 'clone repo'
  18. git clone tmp_repo tmp_repo_clone
  19. cd tmp_repo_clone
  20. status 'checkout and make left branch'
  21. git checkout origin/master -b left
  22. echo 'left' > left_only_file
  23. git add left_only_file
  24. echo 'left' > conflict_file
  25. git add conflict_file
  26. git commit -m conflict_left
  27. status 'checkout and make right branch'
  28. git checkout origin/master -b right
  29. echo 'right' > right_only_file
  30. git add right_only_file
  31. echo 'right' > conflict_file
  32. git add conflict_file
  33. git commit -m conflict_right
  34. status 'merge left'
  35. git merge left
  36. echo 'resolved' > conflict_file
  37. git add conflict_file
  38. echo 'new' > commit_introduced_file
  39. git add commit_introduced_file
  40. status 'try and make diff'
  41. cp .git/index .git/preserved-index
  42. GIT_INDEX_FILE=.git/preserved-index git ls-files --unmerged
  43. GIT_INDEX_FILE=.git/preserved-index git diff-files --name-only
  44. status 'done'
  45.