Git contributions - rebase, squash, push feature branch

Major Git projects such as CMake have a contributor workflow that goes like:

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

git checkout -b add-feature1

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

git checkout master

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

git fetch upstream

git rebase upstream/master

Update the local branch to remote master

git checkout add-feature1

git rebase master

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