Create GitHub account:
Download and install git for win from the official web-site.
During install:
You will have two option for git command line: "powershell.exe" or "git bash". Open one of them.
- If you use
powershell.exe
, you may want to install posh-git module (adds tab-completion and branch name to prompt). - Git command line often ask for interactive input, which makes powershell_ise.exe bad choice for git command line (has native tab-completion and branch name in prompt out-of-the-box).
Warning: git bash is based on MINGW32, so you need to use linux-style paths.
I.e.
cd /c/Windows
, instead ofcd c:\Windows
.
Now you need to setup your name and email global settings.
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL ADDRESS"
And settings for line endings
git config --global core.autocrlf true
To avoid typing username and password all the time, you may setup ssh-key authentication for you github account. This setup is per machine.
Open GitHub repository of a module.
To find, it you can go to all xDscResources
or search in PowerShell GitHub org repos.
I.e. if you want to contribute to xActiveDirectory you can do the following
- Find module
- Click on hyperlink to go to corresponding GitHub repo
- Copy url from the browser or copy it from the GitHub UI on the right
- In PowerShell, run command:
git clone <url>
i.e.
git clone https://github.com/PowerShell/xActiveDirectory
- Git will create a new directory with corresponding name (i.e.
xActiveDirectory
).
To send changes from you local machine, you would first need to upload them to your fork of our repo. Use fork button on the right side of repo GitHub page.
You would need to add your fork as a remote to send changes there.
- Get fork url (same way as original repo url, open fork GitHub page in browser and copy from it).
- Run
git remote add my <url>
, i.e.git remote add my https://github.com/vors/xActiveDirectory
. - Check correctness with
git remote -v
> git remote -v
my https://github.com/vors/xActiveDirectory (fetch)
my https://github.com/vors/xActiveDirectory (push)
origin https://github.com/PowerShell/xActiveDirectory (fetch)
origin https://github.com/PowerShell/xActiveDirectory (push)
- Now you have two remote references: origin to the original repository and my to your fork.
- To make changes, create a new local branch:
git checkout -b <branch>
, i.e.git checkout -b awesome_feature
. - To see all branches, run
git branch -a
> git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Active branch is marked with *
.
-a
flag tells git to show both local and remote branches.
-
make you changes and commit them with
git commit -a -m "<Commit message>"
.-a
flag tells git to include all modified files in commit.-m
flag specifies the commit message. -
To get the big picture of current state of your repository, use
gitk --all
command. It opens a UI with a lot of usefull information. You can read more about gitk here.
- After that can push changes to your fork with
git push my <branch>
command, i.e.git push my awesome_feature
.
Now you should be able to see your branch in your fork on GitHub
You can create a new pull request on the same page
Follow instructions from pull request lifecycle to finish Pull request creating.
To update Pull Request, simply push more commits to the same branch in your GitHub fork, that you use to create the pull request.
git commit -a -m "Update my awesome feature with codereview feedback"
git push my awesome_feature
GitHub would automatically update pull request.
Once your changes have been successfully merged into the hub repository you can delete the branch you used, as you will no longer need it.
Any further work requires a new branch.
To delete your branch follow these steps:
- Run
git checkout master
in the command prompt. This ensures that you aren't in the branch to be deleted (which isn't allowed). - Next, type
git branch -d <branch name>
in the command prompt. This will delete the branch on your local machine only if it has been successfully merged to the upstream repository. (You can override this behavior with the–D
flag, but first be sure you want to do this.) - Finally, type
git push my :<branch name>
in the command prompt (a space before the colon and no space after it). This will delete the branch on your github fork.