Member-only story

Steps on Squashing Commits and Git Rebase

Machine Learning Quick Reads
3 min readJan 20, 2022

--

Notes for myself based on my recent experience, hope it can provide some help to others

Step1. push up your last commit before you run the rebase:

git add .
git commit -m "feature/CORE Notes For Commit"// this is the 6th commit
git push --set-upstream origin feature/CORE-418-update-admin-page-style

Now the commit was pushed to the remote. If things go wrong with the rebase, then, we can delete the branch and pull down the remote copy.

Step2. rebase with the master branch:

git rebase -i HEAD~X X is the number of commits, 6 in my case

Then it shows all the commits done previously. only “pick” the first one and “s” for the rest [“s” stands for “squash” if you prefer to spell it out].

hit Esc to get out from the INSERT mode, then enter :wq to write and quit

--

--

Machine Learning Quick Reads
Machine Learning Quick Reads

Written by Machine Learning Quick Reads

Lead Author: Yaokun Lin, Actuary | ML Practitioner | Apply Tomorrow's Technology to Solve Today's Problems

No responses yet