docs/community/git-workflow.md
Our recommended process for working with Polly is:
git remote add upstream https://github.com/App-vNext/Polly.git)main) using git checkout maingit checkout -b my-branch).dotnet test from the root of the repository
git push origin my-branch)main).You should not work on a clone of the default branch, and you should not send a pull request from it - please always work from a branch. The reasons for this are detailed below.
For an introduction to Git, check out GitHub's Git Guide. For more information about GitHub Flow, please head over to the GitHub Flow documentation.
While you're working away in your branch, it's possible that one or more new commits have been added to the repository's default branch. If this happens you should:
git checkout maingit pull upstream maingit checkout my-branchgit rebase mainThis ensures that your history is "clean" i.e. you have one branch off from main followed by your changes in a straight line. Failing to do this ends up with several "messy" merges in your history, which we don't want. This is the reason why you should always work in a branch and you should never be working in, or sending pull requests from, main.
Rebasing public commits is considered to be bad practice, which is why we ask you to rebase any updates from upstream/main.
If you're working on a long running feature then you may want to do this quite often, rather than run the risk of potential merge issues further down the line.
While working on your feature you may well create several branches, which is fine, but before you send a pull request you should ensure that you have rebased back to a single "feature branch" - we care about your commits, and we care about your feature branch; but we don't care about how many or which branches you created while you were working on it.
When you're ready to go you should confirm that you are up-to-date and rebased with upstream (see "Handling Updates from the default branch" above), and then:
git push origin my-branchIt is not the end of the world if the commit history in your pull request ends up being messy - we can always squash it down to a single commit before merging. However, if you follow the steps above you should end up with a neater history.