GIT Rebase and Squash commits
As people think to rebase and squash, there are a lot of conflicts that come in there mind while updating the latest code instead of rebasing they should create a new branch and manually add their changes in the branch.
Before going on to the steps of rebasing, let us denote the branch which is to be rebased as “rebasee” and the branch from which it is to be rebased as “rebaser”.
There are a few simple steps that a person should remember while doing a rebase
Step1- let’s take the latest pull for both the branch.
Step2- After taking a pull, switch to rebasee, git checkout <rebasee>
Step3- Now, git rebase -i <rebaser>
Step4- For squashing your commits, replace all the “pick” with “s” except the commit you want to pick. Now rebase will start in a recursive manner equivalent to the number of commits
Step5- Now you have 3 options which are git rebase --continue, git rebase --skip, git rebase --abort. If you have conflicts then resolve conflicts and add your changes and do continue. If you want to skip a patch then use a skip command. If you think the changes cannot be resolved or there are too many conflicts then abort rebase for stopping rebase.
After a successful rebase you will get the above the screen. Now, your local branch has been rebased.
Now just use git push to update your branch on Git.