Lose a Commit, Get it Back
Learn how you can remove a commit and then retrieve it.
We'll cover the following
Add commits
First, set up a repository with two commits:
1 mkdir lgthw_reflog
2 cd lgthw_reflog
3 git init
4 echo first commit > file1
5 git add file1
6 git commit -m "first commit"
7 echo second commit >> file1
8 git add file1
9 git commit -am 'second commit message for file1.1'
10 git log
Get hands-on with 1400+ tech skills courses.