brewly — Ch.4 · Get lost commits back
Exercise 6 of 9
Before you start
The reflog remembers
Git keeps a private diary of every place HEAD has been: the reflog. Commits that no branch points to are still there for weeks.
Each line has a name such as HEAD@{1}, meaning "where HEAD was one move ago". You can use it like any commit.
There is no Undo button in this exercise. Real life has none either; the reflog is the way back.
- git reflog
- list where HEAD has been, newest first
- git reset --hard <commit>
- move the branch back to a commit
- git log --oneline
- check what is back
You can reopen this any time with “Lesson”.
# BrewlyOrder coffee ahead.## Team- Maya (lead)- Alex (frontend)
Graph
- 1354d06 Add menu pageHEAD → mainorigin/main
- 619eb3b Style the order button
- 5fc44ac Initial commit