Once you are done working on a feature/topic branch (i.e., new feature or bug fix), you would typically merge it with a develop/integration branch. You can accomplish that by using the git merge or git rebase commands, although both commands will give you different results.
Merge: Retains all changes to and history of the merged branch. The revision history can become complicated after many merge commits.
Rebase: Maintains a clean revision history since merged commits are appended at the end of the target branch. Conflicts may occur more often than in the merge method, and they need to be resolved immediately.
You and your team should decide on which method of merging to use. If you want to keep your revision history simple, you can do the following :
- Use rebase on your feature/topic branch when you want to pull the latest change from the develop/integration branch.
- If you want to merge the change from your feature/topic branch to the develop/integration branch, rebase the feature/topic branch onto the develop/integration branch first. After which, merge the changes from the feature/topic branch into the develop/integration branch. This will be a fast-forward merge with no extra merge commits being created.