fork download
  1. #!/bin/bash
  2.  
  3. # READ ME:
  4. # Please run `git init` if you don't
  5. # init yet before run this script file
  6.  
  7. # C1--C2--C3--C6--C7 <- topic
  8. # \ \ /
  9. # \ C4--C5
  10. # \
  11. # C8--C9 <- master
  12. #
  13. # `topic` rebase to `master`
  14.  
  15. let cm=0 # (commit)
  16. let fc=0 # (file count)
  17.  
  18. # C1 (master, topic)
  19. let cm++; let fc++; touch "file$fc";
  20. git add "file$fc"; git commit -m "C$cm"
  21. git branch topic
  22.  
  23. # C2 (topic, temp)
  24. git checkout topic
  25.  
  26. let cm++; let fc++; touch "file$fc";
  27. git add "file$fc"; git commit -m "C$cm"
  28. git branch temp
  29.  
  30. # C3
  31. let cm++; let fc++; touch "file$fc";
  32. git add "file$fc"; git commit -m "C$cm"
  33.  
  34. # C4-5
  35. git checkout temp
  36.  
  37. let cm++; let fc++; touch "file$fc";
  38. git add "file$fc"; git commit -m "C$cm"
  39.  
  40. let cm++; let fc++; touch "file$fc";
  41. git add "file$fc"; git commit -m "C$cm"
  42.  
  43. # C6
  44. git checkout topic
  45. let cm++
  46. git merge -m "C$cm" temp
  47. git branch -d temp
  48.  
  49. # C7
  50. let cm++; let fc++; touch "file$fc";
  51. git add "file$fc"; git commit -m "C$cm"
  52.  
  53. # C8-9
  54. git checkout master
  55.  
  56. let cm++; let fc++; touch "file$fc";
  57. git add "file$fc"; git commit -m "C$cm"
  58.  
  59. let cm++; let fc++; touch "file$fc";
  60. git add "file$fc"; git commit -m "C$cm"
  61.  
  62. #####
  63. echo -e "\n## Before:"
  64. git log --all --decorate --oneline --graph --pretty="format:%s%d"
  65.  
  66. echo -e "\n## In:"
  67. git checkout topic
  68. git rebase master
  69.  
  70. echo -e "\n## After:"
  71. git log --all --decorate --oneline --graph --pretty="format:%s%d"
  72.  
Runtime error #stdin #stdout #stderr 0s 19632KB
stdin
Standard input is empty
stdout
## Before:

## In:

## After:
stderr
touch: cannot touch 'file1': Permission denied
./prog.sh: line 20: git: command not found
./prog.sh: line 20: git: command not found
./prog.sh: line 21: git: command not found
./prog.sh: line 24: git: command not found
touch: cannot touch 'file2': Permission denied
./prog.sh: line 27: git: command not found
./prog.sh: line 27: git: command not found
./prog.sh: line 28: git: command not found
touch: cannot touch 'file3': Permission denied
./prog.sh: line 32: git: command not found
./prog.sh: line 32: git: command not found
./prog.sh: line 35: git: command not found
touch: cannot touch 'file4': Permission denied
./prog.sh: line 38: git: command not found
./prog.sh: line 38: git: command not found
touch: cannot touch 'file5': Permission denied
./prog.sh: line 41: git: command not found
./prog.sh: line 41: git: command not found
./prog.sh: line 44: git: command not found
./prog.sh: line 46: git: command not found
./prog.sh: line 47: git: command not found
touch: cannot touch 'file6': Permission denied
./prog.sh: line 51: git: command not found
./prog.sh: line 51: git: command not found
./prog.sh: line 54: git: command not found
touch: cannot touch 'file7': Permission denied
./prog.sh: line 57: git: command not found
./prog.sh: line 57: git: command not found
touch: cannot touch 'file8': Permission denied
./prog.sh: line 60: git: command not found
./prog.sh: line 60: git: command not found
./prog.sh: line 64: git: command not found
./prog.sh: line 67: git: command not found
./prog.sh: line 68: git: command not found
./prog.sh: line 71: git: command not found