Git feature branch workflow example

Major Git projects commonly have a contributor workflow like the following description.

Fork the main repo, and on the fork, create a feature branch

git switch -c add-feature1

Once the new work is complete, first be sure it’s consistent with the current parent repo:

git switch main

git remote add upstream (URL of the original remote repo, not your fork)

git fetch upstream

git rebase upstream/main

Update the local branch to remote main

git switch add-feature1

git rebase main

Test your code and then create the Pull Request / Merge Request.