GitHub Gist provides a lightweight way to publish and share one script or code snippet without creating a full repository. Each gist uses Git-based version control, supports syntax highlighting and comments, and can be public or private. section 12.1
Use a gist when you need to:
- Upload an existing PowerShell script from the browser or with the GitHub CLI. section 12.1.1
- Track revisions as edits are saved and automatically published as new versions. section 12.1.2
- Share a private gist by direct URL or create a public gist with the --public switch. section 12.1.3
- Collect comments and feedback, while moving substantial multi-person collaboration to a full repository because gist changes cannot be approved. section 12.1.3
Upload a system-information script
Save a script such as Get-SystemInfo.ps1 locally, then run `gh gist create Get-SystemInfo.ps1 --web` to create the gist and open it in a browser. The script can query Win32_OperatingSystem and select details such as the operating-system caption, architecture, build number, computer name, and total memory. section 12.1.1
gh gist create Get-SystemInfo.ps1 -–web - Creating gist Get-SystemInfo.ps1 ✓Created gist Get-SystemInfo.ps1 Opening gist.github.com/2d0f590c7dde480fba8ac0201ce6fe0f in your browser.
The GitHub CLI command and resulting browser URL show the complete upload workflow for an existing script. section 12.1.1
