Hi guys, today I’m gonna share with you how to use git rebase. The most important word here is “reapply” because a rebase is not simply a ctrl-x/ctrl-v of a branch to another. A rebase will sequentially take all the commit from the branch you’re in, and reapply them to the destination, article from daolf.com.
First of all if you are working on new branch then you can checkout from master and then continue your work on new branch you created. After all the update of your code in your branch you want to merge it with master, just checkout to master and rebase it like below.
git checkout master
# then rebase your master branch with branch you are worked on git rebase your_branch_worked_on git push origin master
The benefit of using rebase when you have a conflict they will automatically detect it for you. So, what you should do just go back to you editor, in my case I used Atom Editor and then confirm that you do the changes to your master branch.
git checkout master git rebase your_branch_worked_on # after fixing your conflict then run git add . git rebase --continue git push origin master
Well done. You don’t have even make new commit any more and just push your master branch to you repository. That’s all of it. Hope it would help you sometime. Thanks.