Please bookmark vanzasetia.netlify.app.

This domain, vanzasetia.xyz, will expire on 27 April 2027.

Git Reflog

Vanza Setia,

Estimated reading time: 1 minute

Problem

You have done a git rebase. Then, you do not like that decision. You want to undo that.

Solution

You solve the problem with git reflog.

You have the following reflog:

2a37136 (HEAD -> main) HEAD@{0}: rebase (finish): returning to refs/heads/main
2a37136 (HEAD -> main) HEAD@{1}: rebase (pick): Make a legal page
608b1eb HEAD@{2}: rebase (fixup): Make a contact page
88c90a5 HEAD@{3}: rebase (start): checkout 70d0caa
90ca0c5 HEAD@{4}: commit: fixup! Make a contact page
edf23a5 HEAD@{5}: reset: moving to HEAD~1
d785b41 HEAD@{6}: rebase (finish): returning to refs/heads/main
d785b41 HEAD@{7}: rebase (start): checkout eecd26c
d785b41 HEAD@{8}: commit: fixup! Make a homepage
edf23a5 HEAD@{9}: commit: Make a legal page
88c90a5 HEAD@{10}: commit: Make a contact page
70d0caa HEAD@{11}: commit: Make an about page
eecd26c HEAD@{12}: commit (initial): Make a homepage

You want to go back to the state where you have not made a fixup! commit for the contact page. You also do not want to lose any local changes.

Steps:

  1. Execute git reflog to get the above output.
  2. Copy the state hash that you want to go back to.
  3. Execute git reset --mixed edf23a5.
Share your thoughts

Topic(s).

Thank you for reading this Git Reflog. You can subscribe to all my articles with the Articles RSS. If you have a positive or negative comment, please send me an email or contact me through one of my social media accounts.

Share with your network

Copy this link and send it to great people only.

https://vanzasetia.xyz/blog/git-reflog/

For you

  • Alternative Text for Decorative Images Must Be Empty

    At first, you may feel tempted to fill the alt attribute with some text. But you have to change that before it becomes a bad habit.

    By Vanza Setia

    a11y

  • Fake Projects

    Beginners love making projects from tutorials. But they do not realize that fake projects, in the end, are fake.

    By Vanza Setia

    mind