Makzan
Makzan

我管理世界職業技能競賽之網站技術項目、舉辦本地設計與開發賽事、開課分享技術心得。一個用網頁來表達自己的作家。

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.

Transcript

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.

Original link: Makzan

CC BY-NC-ND 2.0 版权声明

喜欢我的文章吗?
别忘了给点支持与赞赏,让我知道创作的路上有你陪伴。

加载中…

发布评论