Hands-on task
Drop an unwanted commit with rebase
In /root/repo there are four commits, each of which added its own file: a.txt, secret.txt, c.txt, d.txt. The commit that added secret.txt got into the history by mistake. Remove that commit entirely from the main branch history (don't just delete the file in a new commit — it must not remain in the past either), keeping the other three commits and their files. In the end the history should have three commits left, and secret.txt must not appear in any revision.
- git rebase -i
- rewriting history
- dropping a commit
- GIT_SEQUENCE_EDITOR
- --root