#!/bin/bash # READ ME: # Please run `git init` if you don't # init yet before run this script file # C1--C2--C5--C6--C7--C10--C11--C12--C13 <- topic # \ \ / # \ ---------C3--C4--C8--C9 # \ # C14--C15 <- master # # `topic` rebase to `master` let cm=0 # (commit) let fc=0 # (file count) # C1 (master, topic) let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" git branch topic # C2 (topic, temp) git checkout topic let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" git branch temp # C3-4 git checkout temp let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" # C5-7 git checkout topic let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" # C8-9 git checkout temp let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" # C10-11 git checkout topic let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" # C12 git checkout topic let cm++ git merge -m "C$cm" temp git branch -d temp # C13 git checkout topic let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" # C14-15 git checkout master let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" let cm++; let fc++; touch "file$fc"; git add "file$fc"; git commit -m "C$cm" ##### echo -e "\n## Before:" git log --all --decorate --oneline --graph --pretty="format:%s%d" echo -e "\n## In:" git checkout topic git rebase master echo -e "\n## After:" git log --all --decorate --oneline --graph --pretty="format:%s%d"
Standard input is empty
## Before: ## In: ## After:
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