git reflog

Show a log of all Git references

This command displays a log of all git references like branches, tags, and HEAD. It shows a detailed history of all commits, including those that are not reachable from any branch.

This is useful for recovering lost commits or branches.

By default, git reflog shows a concise list of reference updates with commit hashes and associated messages.

You can use the --relative-date flag to show relative dates instead of absolute dates.

Additionally, you can use the --pretty flag to specify different output formats such as oneline, short, medium, full, or fuller.

The --since=<date> and --until=<date> flags can be used to filter the reflog entries based on the commit timestamp.

For more advanced filtering, you can use the --grep=<pattern> flag to search for specific commit messages.