|
1 | | -GIT |
2 | | ---- |
3 | | -Cloning |
| 1 | +## Getting started |
4 | 2 |
|
5 | | - git clone https://github.com/KSP-SpaceDock/SpaceDock.git |
| 3 | +Please read the [Development Guide](https://github.com/KSP-SpaceDock/SpaceDock/wiki/Development-Guide). |
| 4 | +If you are interested in the infrastructure and production setup of SpaceDock, see [Infrastructure](https://github.com/KSP-SpaceDock/SpaceDock/wiki/Infrastructure). |
6 | 5 |
|
7 | | -Updating |
8 | 6 |
|
9 | | - git fetch --all |
10 | | - git merge |
| 7 | +## GIT |
11 | 8 |
|
12 | | -Contributing |
13 | | -First you will need to fork "SpaceDock" on github, and set up your SSH key. |
| 9 | +### Setup |
14 | 10 |
|
15 | | - git remote rm origin |
16 | | - git remote add upstream https://github.com/KSP-SpaceDock/SpaceDock.git |
17 | | - git remote add origin git@github.com:YOUR_USER_NAME_HERE/SpaceDock.git |
18 | | - git fetch --all |
19 | | - git push --set-upstream origin master |
| 11 | +1) [Fork the repository on GitHub](https://guides.github.com/activities/forking/) |
| 12 | +2) Clone your fork: `git clone https://github.com/<YourUsername>/SpaceDock.git` |
| 13 | +3) Configure `git pull` to do fast-forward merges only: `git config --global pull.ff=only` |
| 14 | +4) Add the main repo as a remote: `git remote add upstream https://github.com/KSP-SpaceDock/SpaceDock.git` |
| 15 | +5) Get the alpha branch from the main repo: `git checkout -b alpha upstream/alpha` |
20 | 16 |
|
21 | | -Make a branch so you don't bork your master. |
22 | 17 |
|
23 | | - git branch bugfix-number |
24 | | - git checkout bugfix-number |
| 18 | +### Adding changes |
25 | 19 |
|
26 | | -Do your changes here with your favourite text editor or IDE. |
| 20 | +1) First check out `alpha`: `git checkout alpha` |
| 21 | +2) Make sure it is up-to-date: `git pull upstream alpha` |
| 22 | +3) Create a new branch: `git checkout -b fix/<one-to-three-word-summary>` |
| 23 | + We tend to prefix our branch names with `fix/` for bugfixes and `feature/` for new features |
| 24 | +4) Do your changes here with your favourite text editor or IDE. |
| 25 | +5) Add your changes to the index: `git add <path/to/changed/file> <path/to/another/file>` |
| 26 | + Make sure you only add changes that you actually want to commit! `git commit -A` might include files you didn't want to. |
| 27 | + You can review your currently added changes with: `git diff --staged` |
| 28 | +6) Create a commit with the staged changes: `git commit -m "A small message about your commit` |
| 29 | +7) Push the changes to your GitHub fork: `git push --set-upstream origin fix/<one-to-three-word-summary>` |
| 30 | +8) Prepare a pull request on GitHub. If you open your fork on github.com it probably already shows you a button to do this. |
| 31 | + Enter a detailed summary into the PR body text box. |
| 32 | + Include your motivation for the feature, a way to reproduce the bug if possible, and other points that might be important or helpful for reviewers. |
| 33 | + Go through your diff one more time to make sure everything is included, do a "self-review". |
27 | 34 |
|
28 | | - git add -A |
29 | | - git commit -a -m "A small message about your commit" |
30 | | - git push --set-upstream origin bugfix-number |
31 | | - |
32 | | -When you are happy with the code, open a pull request on github. After it is merged you can delete it and merge it in your master |
33 | | - |
34 | | - git checkout master |
35 | | - git fetch --all |
36 | | - git merge upstream/master |
37 | | - git branch -D bugfix-number |
38 | | - git push origin :bugfix-number |
| 35 | +There are more extensive guides available at https://guides.github.com/, e.g. |
| 36 | +- https://github.com/git-guides |
| 37 | +- https://guides.github.com/introduction/git-handbook/ |
| 38 | +- https://guides.github.com/introduction/flow/ |
0 commit comments