Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
README.md103 linesDownload Raw Back to git
1# Working with PowerShell repository2 3## Get the code for the first time4 5```sh6git clone https://github.com/PowerShell/PowerShell.git --branch=master7```8 9## Branches10 11* Don't commit your changes directly to master.12  It will make the collaborative workflow messy.13* Checkout a new local branch from `master` for every change you want to make (bugfix, feature).14* Use lowercase-with-dashes for naming.15* Follow [Linus' recommendations][Linus] about history.16  * "People can (and probably should) rebase their _private_ trees (their own work). That's a _cleanup_. But never other peoples code. That's a 'destroy history'...17  You must never EVER destroy other peoples history. You must not rebase commits other people did.18  Basically, if it doesn't have your sign-off on it, it's off limits: you can't rebase it, because it's not yours."19 20### Understand branches21 22* **master** is the branch with the latest and greatest changes.23  It could be unstable.24* Send your pull requests to **master**.25 26### Sync your local repository27 28Use **git rebase** instead of **git merge** and **git pull**, when you're updating your feature-branch.29 30```sh31# fetch updates all remote branch references in the repository32# --all : tells it to do it for all remotes (handy, when you use your fork)33# -p : tells it to remove obsolete remote branch references (when they are removed from remote)34git fetch --all -p35 36# rebase on origin/master will rewrite your branch history37git rebase origin/master38```39 40### More complex scenarios41 42Covering all possible git scenarios is behind the scope of the current document.43Git has excellent documentation and lots of materials available online.44 45We are leaving a few links here:46 47[Linus]:https://web.archive.org/web/20230522041845/https://wincent.com/wiki/git_rebase%3A_you're_doing_it_wrong48 49## Tags50 51If you are looking for the source code for a particular release,52you will find it via **tags**.53 54* `git tag` will show you list of all tags.55* Find the tag that corresponds to the release.56* Use `git checkout <tag-name>` to get this version.57 58**Note:** [checking out a tag][tag] will move the repository to a [DETACHED HEAD][HEAD] state.59 60[tag]:https://git-scm.com/book/en/v2/Git-Basics-Tagging#Checking-out-Tags61[HEAD]:https://www.git-tower.com/learn/git/faq/detached-head-when-checkout-commit62 63If you want to make changes, based on tag's version (i.e. a hotfix),64checkout a new branch from this DETACHED HEAD state.65 66```sh67git checkout -b vors/hotfix68```69 70## Recommended Git configurations71 72We highly recommend these configurations to help deal with whitespace,73rebasing, and general use of Git.74 75> Auto-corrects your command when it's sure (`stats` to `status`)76 77```sh78git config --global help.autoCorrect -179```80 81> Refuses to merge when pulling, and only pushes to branch with same name.82 83```sh84git config --global pull.ff only85git config --global push.default current86```87 88> Shows shorter commit hashes and always shows reference names in the log.89 90```sh91git config --global log.abbrevCommit true92git config --global log.decorate short93```94 95> Ignores whitespace changes and uses more information when merging.96 97```sh98git config --global apply.ignoreWhitespace change99git config --global rerere.enabled true100git config --global rerere.autoUpdate true101git config --global am.threeWay true102```103