Git contributor feature branch workflow
Major Git projects commonly have a contributor workflow where other contributors fork a primary Git repository, make changes, and then contribute back to the primary project. This article describe the contributor workflow. The maintainer workflow is in a separate article.
The contributor forks the primary project Git repo. On the local copy of the fork, create a feature branch:
git switch -c add-feature1
Once the new work is complete, make the branch consistent with the primary repo by pulling in the latest changes from the primary repo:
git switch main # whatever the primary or development branch of the primary repo is git remote add upstream https://github.invalid/primary/repo_url git fetch upstream git rebase upstream/main
Update the local branch to remote main
git switch add-feature1 git rebase main
Test the final updated code. Create the Pull Request / Merge Request for the maintainer to evaluate the changes and possibly put them into the primary project.