For a presentation I was holding at work I created a git commit timeline that could help me “cheat a little bit” as Ingrid Espelid Hovig would’ve put it.
However, I needed to go back in time and put something at the beginning of that commit timeline.
So - doing a commit between commit A and commit B:
- Start an interactive rebase to a commit at some point before the commit you want to insert after:
git rebase -i <commithash>
- Vim should start up and you’ll get a list of commits. Find the commit you want to add after and switch from pick to edit
- Save and exit vim
- Make the changes you want and do:
git add
andgit commit
- Continue the rebase:
git rebase --continue
Obviously the hardest part of this is step 3…