Git Reference Logs in 1 minute

The git reference logs command allows us to refer to where the branch was pointing to. That enables us to rescue the commits that are already missing in the git log because no any branches or tags are pointing to them.
This is part of the 1-minute video series for web development.


Hey there, this is Thomas from Macao.

In this video, I would like to talk about the git reference logs.
The Git reference logs command gives us the ability to rescue any removed commits, at least in a short period before we purge the log history. 

For example, if we want to group the latest 3 commits into 1 commit before pushing it to remote, we may perform a soft reset and then create a single commit again. That commit will contain all the changes for those 3 commits. 
But if anything went wrong and we want to revert to the state before we reset, we need the reference of the original 3 commits. 

By using the git reflog command, we can show the original 3 commits and the hash. We can then reset the branch back to the state where we were in.

That’s it for the basic git reference log introduction. In the next video, I will show the date range query for commits and combine it with the git reference log.

I teach web design. I write books on HTML5 games development. I host classes on mobile web and app development. I made animation with Adobe Flash (now Animate).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.