Please bookmark vanzasetia.netlify.app.

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

Git Rebase Autosquash

Vanza Setia,

Estimated reading time: 1 minute

Problem

You have the following local commits:

edf23a5 (HEAD -> main) Make a legal page
88c90a5 Make a contact page
70d0caa Make an about page
eecd26c Make a homepage

The problem is you find a typo on the contact page, and you do not want to make a new commit.

Solution

You can solve it with git rebase.

git commit --fixup COMMIT_HASH
git rebase -i --autosquash COMMIT_HASH

Steps:

  1. Copy the commit hash that you want to fix.
  2. Execute git commit --fixup 88c90a5.
  3. Copy the commit hash before the commit that you want to fix.
  4. Execute git rebase -i --autosquash 70d0caa.
  5. Close the editor.

Once you are done, you get a new commit hash for the targeted commit and the commit above it.

2a37136 (HEAD -> main) Make a legal page
608b1eb Make a contact page
70d0caa Make an about page
eecd26c Make a homepage
Share your thoughts

Topic(s).

Thank you for reading this Git Rebase Autosquash. 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-rebase-autosquash/

For you

  • Scroll

    Do you know that you can scroll down? Do you think I should tell you to do that?

    By Vanza Setia

    language

  • My Word Choice in English and Indonesian

    English and Indonesian have some unique connections. Some Indonesian terms are the correct terms to use in English. Some English terms are the correct terms to use in Indonesian. Sometimes both are wrong.

    By Vanza Setia

    language