Member-only story
Steps on Squashing Commits and Git Rebase
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 commitgit 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