How To Use Git Rebase
Keep a clean history with rebase, instead of cluttering your teams commit history. This is the simplest way how to use git rebase.
I will use these two branches in this example:
dev- the main branch
feature- the newly created branch
Always rebase before a merge
# checkout new branch > git checkout -b feature # make commits > ... # make a pull with rebase before merge (if long branch, do occasional rebases) > git checkout dev > git pull --rebase > git checkout feature > git rebase dev # merge when done > git checkout dev > git merge feature # delete branch > git branch -d feature