<commit_before>Working with PowerShell repository
==================================

#### Get the code for the first time

```sh
git clone --recursive https://github.com/PowerShell/PowerShell
```

PowerShell repository has **submodules**.
They are required to build and test powershell.
That's why you need `--recursive`, when you `clone`.


If you already cloned the repo without `--recursive`, update submodules manually

```sh
git submodule init
git submodule update
```

See [FAQ](../FAQ.md#why-is-my-submodule-empty) for details.



Branches
---------

* Don't commit your changes directly to master.
  It would make workflow messy.
* Checkout a new local branch from master for every change you want to make (bugfix, feature).
* Use `alias/feature-name` pattern.
* Use lowercase-with-dashes for naming.
* Follow [Linus' recommendations][Linus] about history.
  - 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"
  - You must never EVER destroy other peoples history. You must not rebase 
    commits other people did. 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.

#### Understand branches

* **master** is the branch with the latest and gratest changes.
  It could be unstable.
* Send your Pull Requests to **master**.

#### Sync your local repo

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

```sh
# switch to master branch

# fetch updates all remote branch references in the repo and all submodules
# --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

# pull updates your local files
# you should call this command ONLY from master branch
git pull origin master

```

Then switch to your branch and do rebase

```
git rebase master
```

#### Git pretty

[So you have a mess on your hands?](http://justinhileman.info/article/git-pretty/)

[Linus]:http://thread.gmane.org/gmane.comp.video.dri.devel/34739/focus=34744




Tags<commit_msg>Add more complex scenarios section to powershell-repository-101<commit_after>Working with PowerShell repository
==================================

#### Get the code for the first time

```sh
git clone --recursive https://github.com/PowerShell/PowerShell
```

PowerShell repository has **submodules**.
They are required to build and test powershell.
That's why you need `--recursive`, when you `clone`.


If you already cloned the repo without `--recursive`, update submodules manually

```sh
git submodule init
git submodule update
```

See [FAQ](../FAQ.md#why-is-my-submodule-empty) for details.



Branches
---------

* Don't commit your changes directly to master.
  It would make workflow messy.
* Checkout a new local branch from master for every change you want to make (bugfix, feature).
* Use `alias/feature-name` pattern.
* Use lowercase-with-dashes for naming.
* Follow [Linus' recommendations][Linus] about history.
  - 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"
  - You must never EVER destroy other peoples history. You must not rebase 
    commits other people did. 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.

#### Understand branches

* **master** is the branch with the latest and gratest changes.
  It could be unstable.
* Send your Pull Requests to **master**.

#### Sync your local repo

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

```sh
# switch to master branch

# fetch updates all remote branch references in the repo and all submodules
# --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

# pull updates your local files
# you should call this command ONLY from master branch
git pull origin master

```

Then switch to your branch and do rebase

```
git rebase 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](http://justinhileman.info/article/git-pretty/): what to do, when your local repo became a mess.

[Linus]:http://thread.gmane.org/gmane.comp.video.dri.devel/34739/focus=34744



Tags
{'fraction_non_alphanumeric': 0.1089567966280295, 'fraction_numerical': 0.004847207586933615, 'mean_word_length': 3.954070981210856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2121996', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1288, 'n_words': 624}