Skip to content

Instantly share code, notes, and snippets.

@cmattoon
Last active August 29, 2015 14:16
Show Gist options
  • Save cmattoon/13aa5c8d711a7ffc7899 to your computer and use it in GitHub Desktop.
Save cmattoon/13aa5c8d711a7ffc7899 to your computer and use it in GitHub Desktop.
Removing commit #5 with git rebase
a2971b1 (HEAD, master) Commit # {10} [Curtis Mattoon]
0 0 file_10
feb3de8 Commit # {9} [Curtis Mattoon]
0 0 file_9
cc74178 Commit # {8} [Curtis Mattoon]
0 0 file_8
bfcbc72 Commit # {7} [Curtis Mattoon]
0 0 file_7
5e4a81e Commit # {6} [Curtis Mattoon]
0 0 file_6
f56f744 Commit # {4} [Curtis Mattoon]
0 0 file_4
b7921b8 Commit # {3} [Curtis Mattoon]
0 0 file_3
4eff6f9 Commit # {2} [Curtis Mattoon]
0 0 file_2
89d4403 Commit # {1} [Curtis Mattoon]
0 0 file_1
6d0bad8 (HEAD, master) Commit # {10} [Curtis Mattoon]
0 0 file_10
169bd28 Commit # {9} [Curtis Mattoon]
0 0 file_9
5fc887c Commit # {8} [Curtis Mattoon]
0 0 file_8
27dc7a2 Commit # {7} [Curtis Mattoon]
0 0 file_7
f762e47 Commit # {6} [Curtis Mattoon]
0 0 file_6
41be8ac Commit # {5} [Curtis Mattoon]
0 0 file_5
f56f744 Commit # {4} [Curtis Mattoon]
0 0 file_4
b7921b8 Commit # {3} [Curtis Mattoon]
0 0 file_3
4eff6f9 Commit # {2} [Curtis Mattoon]
0 0 file_2
89d4403 Commit # {1} [Curtis Mattoon]
0 0 file_1
$git rebase --onto 41be8ac^ 41be8ac
First, rewinding head to replay your work on top of it...
Applying: Commit # {6}
Applying: Commit # {7}
Applying: Commit # {8}
Applying: Commit # {9}
Applying: Commit # {10}
#!/bin/bash
for i in `seq 1 10`;
do
touch "file_${i}"
git add "file_${i}"
git commit -m "Commit # {$i}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment