I was taught to use git rebase from now on before making a pull request. Honestly, the command it self was confusing. This is how I understood git rebase
rebasing the master branch.
The command for git rebase is git rebase -i master. -i represents interactive, which allows you to choose commits to include as you rebase your master branch.After using the command, you face a message like the image below;

Using the commands explained, you can choose which commits to use. If you are going to use all the commands, you just have to leave the top commit as pick, and choose the rest as s, or squash so that all the commits can be squashed together.
So then, why do you have to use git rebase when you can simply just git add and then git commit?
git rebase ensures that the orders of commits do not get messed up. When you make a pull request the master/develop branch pulls each commit based on the time that it was made. Therefore, it is difficult to track down the history of each commit. And it gets worse if you have to revert your commit since commits from different feature branches are all mixed together.
By using git rebase, you need to take more time before making a pull request, but you can prevent the master branch from having mixed-up history of commits from different branches.