Git is a decentralized source-control system for tracking PowerShell projects and coordinating changes. Each contributor can keep a local copy, periodically merge updates, and publish a protected or web-hosted copy when needed. Its command-line workflow is worth learning because most Git guidance uses it. section 19.2 section 19.0
Build a practical local workflow from a project folder:
- Install the Windows client, restart any existing PowerShell session so the updated path is detected, and configure a username and email address. section 19.2.1 section 19.2.2
- Create or enter the project’s root directory, then run git init. Git creates a hidden .git directory and a main branch; run commands from the repository root. section 19.3 section 19.3.1
- Use git status to find untracked files, git add to stage them, and git commit -m to create a named checkpoint. section 19.3.1 section 19.3.3
- Inspect history with git log, use branches for isolated development, compare branches with git diff, and merge finished work into main. section 19.3.3 section 19.3.5
Develop safely on a branch
Inside MyPSTool, create and check out a dev branch, add devdata.txt, stage and commit it, then return to main. The new file is absent from main until git merge dev integrates it. Afterward, delete the completed branch with git branch -d dev. This keeps experimental work separate from the current version and makes scrapping unfinished work less disruptive. section 19.3.5
Publish and synchronize a project
Create a GitHub repository for an existing local project, add it as the origin remote, and push main with git push -u origin main. Later commits can be pushed normally; git fetch retrieves remote updates, git pull applies them locally, and git clone creates a local working copy of another repository. section 19.5
PS C:\> git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
...
Use the command-line usage listing as a quick orientation before consulting detailed command help or the Git tutorial. section 19.2.2







