Use git rebase -i
to enter interactive rebase mode.
In the first commit, replace pick
with e
to edit at that particular point and exit nano.
Now make changes in the file and commit using git add file.txt
and git commit --amend -m "ok"
When we try to use git rebase --continue
we encounter a merge conflict.
Simply fix that merge conflict by replacing the text in file.txt
with
Hello world
Hello world is an excellent program
Add it to the staging area using git add file.txt
and then use git rebase --continue
to go back.