Rebase workflow with feature branches¶
A rebase workflow with feature branches is a Git strategy that integrates changes from a main branch (typically master) into a feature branch using git rebase. This approach creates a linear project history, incorporating the latest upstream changes before merging the feature back into the main branch^[600-developer__tools__git__git-rebase.md].
Workflow Procedure¶
The standard rebase workflow follows a sequence of branching, updating, replaying, and merging.
- Feature Development: Create and switch to a feature branch (e.g.,
issueorfeature) to implement changes^[600-developer__tools__git__git-rebase.md]. - Update Main: Switch to the main branch (
master) and rungit pullto ensure it has the latest changes from the remote repository^[600-developer__tools__git__git-rebase.md]. - Rebase Feature: Switch back to the feature branch. Execute
git rebase masterto move the base of the feature branch to the tip ofmaster^[600-developer__tools__git__git-rebase.md]. This replays the feature commits on top of the updated main history. - Resolve Conflicts: If conflicts occur during the rebase, resolve them manually^[600-developer__tools__git__git-rebase.md]. After fixing the files, stage them with
git add .and continue the process withgit rebase --continue^[600-developer__tools__git__git-rebase.md]. - Final Merge: Switch back to
masterand perform a fast-forward merge usinggit merge issue^[600-developer__tools__git__git-rebase.md]. - Cleanup: Delete the feature branch to remove the obsolete reference^[600-developer__tools__git__git-rebase.md].
Related Concepts¶
- [[Feature Branch Workflow]]
- [[Git Merge]]
- Git Rebase
Sources¶
^[600-developer__tools__git__git-rebase.md]