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--C5--C6--C7--C10--C11--C12--C13 <- topic
  8. # \ \ /
  9. # \ ---------C3--C4--C8--C9
  10. # \
  11. # C14--C15 <- 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-4
  31. git checkout temp
  32.  
  33. let cm++; let fc++; touch "file$fc";
  34. git add "file$fc"; git commit -m "C$cm"
  35.  
  36. let cm++; let fc++; touch "file$fc";
  37. git add "file$fc"; git commit -m "C$cm"
  38.  
  39. # C5-7
  40. git checkout topic
  41.  
  42. let cm++; let fc++; touch "file$fc";
  43. git add "file$fc"; git commit -m "C$cm"
  44.  
  45. let cm++; let fc++; touch "file$fc";
  46. git add "file$fc"; git commit -m "C$cm"
  47.  
  48. let cm++; let fc++; touch "file$fc";
  49. git add "file$fc"; git commit -m "C$cm"
  50.  
  51. # C8-9
  52. git checkout temp
  53.  
  54. let cm++; let fc++; touch "file$fc";
  55. git add "file$fc"; git commit -m "C$cm"
  56.  
  57. let cm++; let fc++; touch "file$fc";
  58. git add "file$fc"; git commit -m "C$cm"
  59.  
  60. # C10-11
  61. git checkout topic
  62.  
  63. let cm++; let fc++; touch "file$fc";
  64. git add "file$fc"; git commit -m "C$cm"
  65.  
  66. let cm++; let fc++; touch "file$fc";
  67. git add "file$fc"; git commit -m "C$cm"
  68.  
  69. # C12
  70. git checkout topic
  71. let cm++
  72. git merge -m "C$cm" temp
  73. git branch -d temp
  74.  
  75. # C13
  76. git checkout topic
  77.  
  78. let cm++; let fc++; touch "file$fc";
  79. git add "file$fc"; git commit -m "C$cm"
  80.  
  81. # C14-15
  82. git checkout master
  83.  
  84. let cm++; let fc++; touch "file$fc";
  85. git add "file$fc"; git commit -m "C$cm"
  86.  
  87. let cm++; let fc++; touch "file$fc";
  88. git add "file$fc"; git commit -m "C$cm"
  89.  
  90. #####
  91. echo -e "\n## Before:"
  92. git log --all --decorate --oneline --graph --pretty="format:%s%d"
  93.  
  94. echo -e "\n## In:"
  95. git checkout topic
  96. git rebase master
  97.  
  98. echo -e "\n## After:"
  99. git log --all --decorate --oneline --graph --pretty="format:%s%d"
  100.  
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
./prog.sh: line 31: git: command not found
touch: cannot touch 'file3': Permission denied
./prog.sh: line 34: git: command not found
./prog.sh: line 34: git: command not found
touch: cannot touch 'file4': Permission denied
./prog.sh: line 37: git: command not found
./prog.sh: line 37: git: command not found
./prog.sh: line 40: git: command not found
touch: cannot touch 'file5': Permission denied
./prog.sh: line 43: git: command not found
./prog.sh: line 43: git: command not found
touch: cannot touch 'file6': Permission denied
./prog.sh: line 46: git: command not found
./prog.sh: line 46: git: command not found
touch: cannot touch 'file7': Permission denied
./prog.sh: line 49: git: command not found
./prog.sh: line 49: git: command not found
./prog.sh: line 52: git: command not found
touch: cannot touch 'file8': Permission denied
./prog.sh: line 55: git: command not found
./prog.sh: line 55: git: command not found
touch: cannot touch 'file9': Permission denied
./prog.sh: line 58: git: command not found
./prog.sh: line 58: git: command not found
./prog.sh: line 61: git: command not found
touch: cannot touch 'file10': Permission denied
./prog.sh: line 64: git: command not found
./prog.sh: line 64: git: command not found
touch: cannot touch 'file11': Permission denied
./prog.sh: line 67: git: command not found
./prog.sh: line 67: git: command not found
./prog.sh: line 70: git: command not found
./prog.sh: line 72: git: command not found
./prog.sh: line 73: git: command not found
./prog.sh: line 76: git: command not found
touch: cannot touch 'file12': Permission denied
./prog.sh: line 79: git: command not found
./prog.sh: line 79: git: command not found
./prog.sh: line 82: git: command not found
touch: cannot touch 'file13': Permission denied
./prog.sh: line 85: git: command not found
./prog.sh: line 85: git: command not found
touch: cannot touch 'file14': Permission denied
./prog.sh: line 88: git: command not found
./prog.sh: line 88: git: command not found
./prog.sh: line 92: git: command not found
./prog.sh: line 95: git: command not found
./prog.sh: line 96: git: command not found
./prog.sh: line 99: git: command not found