Using: Windows 10, command-line with git commands
I was using git (following this tutorial: https://help.github.com/en/github/committing-changes-to-your-project/changing-a-commit-message) to change some old messages to commit messages to add something to each one. I used the command: git rebase -i HEAD~10
and this showed the last 10 commits. After naming each 'pick' with 'reword' to the commit messages I wanted, I was not sure how to exit and save. Therefore, I decided to click the cross button on the command prompt and when I checked git log again on my project, all the last 10 commits were gone. How can I recover them?
Open bash and go again to the repository directory. You should be at a "rebase x/x" state as pointed by the blue words at the end of the line.
You can use then "git rebase --abort" to return to the point before executing the interactive rebase command.
(Source: https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---abort)