Rewriting History – Changing the already existing commits
- Refer Here for rewriting history
Changing latest commit message
- We have created a commit

- Commit message has a typo
- we need to change the commit message

Changing the older commit message
- We have the following commits

- We need to change the commit message of
594526ato “Added 4.txt” - we need to rewrite from one position behind head
HEAD~1

- When using interactive rebase use
HEAD~1+1

- In this we need to reword since we need to change the commit message.

Other scenarios
- Refer classroom video for
- deleting commits
- combining commits
Git reflog
- Refer Here for official docs
- Git reflog is like a permanent log of local git repo
- Now using reflogs we can undo certain stuff
-
Exercise:
- Create 5 commits assuming 5 is latest commit
- Delete commit 4 and try to recover using reflog.
- Try now
