"Fossies" - the Fresh Open Source Software Archive

Member "PowerShell-7.2.6/docs/git/README.md" (11 Aug 2022, 3381 Bytes) of package /linux/misc/PowerShell-7.2.6.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Working with PowerShell repository

Get the code for the first time

git clone https://github.com/PowerShell/PowerShell.git --branch=master


Understand branches

Sync your local repo

Use git rebase instead of git merge and git pull, when you're updating your feature-branch.

# fetch updates all remote branch references in the repo
# --all : tells it to do it for all remotes (handy, when you use your fork)
# -p : tells it to remove obsolete remote branch references (when they are removed from remote)
git fetch --all -p

# rebase on origin/master will rewrite your branch history
git rebase origin/master

More complex scenarios

Covering all possible git scenarios is behind the scope of the current document. Git has excellent documentation and lots of materials available online.

We are leaving few links here:

Git pretty flowchart: what to do, when your local repo became a mess.


If you are looking for the source code for a particular release, you will find it via tags.

Note: checking out a tag will move the repo to a DETACHED HEAD state.

If you want to make changes, based on tag's version (i.e. a hotfix), checkout a new branch from this DETACHED HEAD state.

git checkout -b vors/hotfix

We highly recommend these configurations to help deal with whitespace, rebasing, and general use of Git.

Auto-corrects your command when it's sure (stats to status)

git config --global help.autoCorrect -1

Refuses to merge when pulling, and only pushes to branch with same name.

git config --global pull.ff only
git config --global push.default current

Shows shorter commit hashes and always shows reference names in the log.

git config --global log.abbrevCommit true
git config --global log.decorate short

Ignores whitespace changes and uses more information when merging.

git config --global apply.ignoreWhitespace change
git config --global rerere.enabled true
git config --global rerere.autoUpdate true
git config --global am.threeWay true