Files
30-seconds-of-code/snippets/view-undo-history.md
Isabelle Viktoria Maciohsek 06b007d41a Fix cover
2022-07-13 22:52:51 +03:00

32 lines
1.1 KiB
Markdown

---
title: View "undo" history
tags: repository,branch
expertise: advanced
author: maciv
cover: blog_images/rock-climbing.jpg
firstSeen: 2021-04-06T16:35:56+03:00
lastUpdated: 2021-04-13T21:10:59+03:00
---
View git's reference logs. This is especially useful for finding references that don't show up in commit history.
- Use `git reflog` to display the git reference log.
- View your "undo" history
Because sometimes git log doesn't cut it, especially for commands that don't show up in your commit history.
reflog is basically your safety net after running "scary" commands like git rebase. You'll be able to see not only the commits you made, but each of the actions that led you there.
```shell
git reflog
```
```shell
git reflog
# b6a4f9d6ff9 (HEAD -> patch-1, origin/patch-1) HEAD@{0}: Update docs
# 3050fc0de HEAD@{1}: rebase -i (finish): returning to refs/heads/patch-1
# 3050fc0de HEAD@{2}: rebase -i (pick): Fix network bug
# 93df3f495 (origin/patch-2) HEAD@{3}: rebase -i (start): checkout origin/master
# 69beaeabb HEAD@{4}: rebase -i (finish): returning to refs/heads/patch-1
```