how to refactoring code using git rebase
I used my repo to practice git rebase
. First, I created a new branch to do the changes.
git checkout -b refactoring master
Then I tried to find some improvement in my code. I found four improvements. After I finished each improvement:
git add .
git commit -m "message"
When I finish all my changes. I checked my commits with git log
, add all the changes are in the log.
All the magic happens next step:
git rebase master -i
And I squash all other commits which I don't need to show on the log.
// change commit message.
git commit --ament
merge and push
git checkout master
git merge refactoring
git push origin master
Top comments (0)