GitHub workflow for a forked repository

The following image illustrates the workflow for using Git and GitHub to update files in the PowerShell-Docs repository. The steps shown in red are a one-time action for each new repository you fork.

StepsDescription of stepsGit command / GitHub actions
AFork the repoBrowse to https://github.com/PowerShell-Docs/PowerShell-Docs and select the Fork button (top right). Open the Choose and owner dropdown and select your personal account. Select the Create fork button.
BClone the repo (once per machine)git clone https://github.com/<your-account>/PowerShell-Docs.git
CAdd the upstream remotegit remote add upstream https://github.com/PowerShell-Docs/PowerShell-Docs.git

Blog GitHub workflow Blog GitHub workflow

The numbered steps (in black) are described in the table below.

StepsDescription of stepsGit command / GitHub actions
0Checkout the main branchgit checkout main
1Sync the main branchgit pull upstream maingit push origin main
2Create a new working branchgit checkout -b workingbranch
3Create new contentUse VS Code to create or edit files
4Add changes for Git trackinggit add -A
5Commit changes to local repogit commit -m 'commit message'
6Push working branch to forkgit push origin workingbranch
7Submit pull requestGo to https://github.com/MicrosoftDocs/PowerShell-Docs/pulls and click the New pull request button.Base repository: MicrosoftDocs/PowerShell-Docs base: main <– head repository: username/PowerShell-Docs compare: workingbranch Fill out the pull request description and click Submit.
8PR is reviewedMake the necessary changes based on the review feedback.
9PR is mergedGo to step 10
10Cleanup unneeded branch infogit checkout maingit push origin --delete workingbranchgit branch -D workingbranchThe git push command deletes the branch in your fork and deletes the tracking branch from your local repo. The git branch command deletes the branch from your local repo.
11Start new changeGo to step 0