The classic example of using git-rebase is when a developer is working on their own branch while commits are made to the master branch, then the developer wants to sync up with the master branch, maybe as a precursor to merging the changes back into the master branch. Git’s rebase handles this elegantly by pushing the changes on the developers branch, moving the point where the developers branch is forked from the master branch, then apply the saved changes to the new developers branch.
For completeness, the command is:
git rebase master developer_branch
But for grins, let’s turn the problem around. Let’s say that you use a code generator to jump start your project. What usually happens is the code generators are only used until you invest time and effort into changing the code. Wouldn’t it be nice to be able to use the code generators through out the development cycle?
The easiest way is to create a ‘generated’ branch for the code generators to use then rebase to master.
In this case the command would be:
git rebase generated master
While you will have to manually refactor any name changes on the master branch introduced by the generated branch, you now have the option of using the generators over the life of the project.