| 1 | == Contributing guidelines == |
| 2 | |
| 3 | The development workflow changes notably after [https://trac.osgeo.org/grass/wiki/GitMigration#ImplementationofmigrationfromOSGeoSVNandtractoGitHub migration from Subversion to git] (!GitHub). |
| 4 | |
| 5 | Important changes: |
| 6 | * committing to "master" (former "trunk") is a no-go and disabled |
| 7 | * hence: you will open a pull request for a change, even being a core developer |
| 8 | * Rationale: pull requests are the perfect platform to discuss/improve changes before merging. |
| 9 | |
| 10 | If you are a core developer: |
| 11 | * the core devs don't go though forks, but create feature branch(es) for changes |
| 12 | |
| 13 | If you are an "external" contributor: |
| 14 | * you may fork the GRASS GIS repository and suggest your changes as pull requests. |
| 15 | |
| 16 | === Workflow for core developers === |
| 17 | |
| 18 | Here no fork needed but create feature branch(es) on master. |
| 19 | |
| 20 | {{{ |
| 21 | # <make local source code changes> |
| 22 | vim ... |
| 23 | |
| 24 | # fetch all branches from all remotes |
| 25 | git fetch --all |
| 26 | |
| 27 | # list existing branches: |
| 28 | git branch -a |
| 29 | |
| 30 | # create new local branch (pick a new name for feature_branch_name) |
| 31 | git checkout -b $feature_branch_name |
| 32 | |
| 33 | # list local changes |
| 34 | git status |
| 35 | git add file1.c file2.py ... |
| 36 | git commit -m 'my change with reasonable explanation...' |
| 37 | |
| 38 | # push feature branch to origin, i.e. original GRASS GIS repo master |
| 39 | git push origin $feature_branch_name |
| 40 | # create pull request in GitHub Web interface (the link is shown in |
| 41 | the terminal) |
| 42 | |
| 43 | # during PR review phase, make more local changes if needed |
| 44 | git add . |
| 45 | git commit -m 'my second change' |
| 46 | git push origin $feature_branch_name |
| 47 | # ..... will be added to existing pull request |
| 48 | }}} |
| 49 | |
| 50 | NOTE: for different pull requests, simply create different feature branches. |
| 51 | |
| 52 | === Workflow for external contributors - option 1 === |
| 53 | |
| 54 | - to be discussed - |
| 55 | |
| 56 | First fork the GRASS GIS repo in the !GitHub web interface. |
| 57 | |
| 58 | {{{ |
| 59 | # create fork via GitHub Web interface |
| 60 | |
| 61 | # checkout your fork |
| 62 | git clone $my_for_url |
| 63 | |
| 64 | # all steps see above, core dev section |
| 65 | ... |
| 66 | |
| 67 | # push feature branch to own fork repo of GRASS GIS |
| 68 | git push origin $feature_branch_name # here: origin is fork repo |
| 69 | |
| 70 | # create pull request in GitHub Web interface (the link is shown conveniently in the terminal) |
| 71 | }}} |
| 72 | |
| 73 | |
| 74 | === Workflow for external contributors - option 2 === |
| 75 | |
| 76 | - to be discussed - |
| 77 | |
| 78 | You clone the GRASS GIS repo and add the fork as an additional remote, this makes merging changes from the GRASS GIS repo easier. |
| 79 | |
| 80 | {{{ |
| 81 | git clone https://github.com/OSGeo/grass.git |
| 82 | cd grass |
| 83 | git remote add github https://github.com/<username>/grass.git |
| 84 | git remote set-url --push github |
| 85 | ssh://git@github.com/<username>/grass.git |
| 86 | ... |
| 87 | git push github <feature-branch> |
| 88 | }}} |
| 89 | |
| 90 | This way origin is the authoritative source for the code, and additional remotes are forks. |
| 91 | |
| 92 | == Review of pull requests == |
| 93 | |
| 94 | In the review phase, PRs can be commented and modified. |
| 95 | |
| 96 | TODO add more |
| 97 | |
| 98 | == Merging of pull requests == |
| 99 | |
| 100 | The CI should run successfully for every commit (chunk of commits in PR to be exact) before it goes into master. |
| 101 | |
| 102 | == Backporting to release branches == |
| 103 | |
| 104 | TODO |
| 105 | |
| 106 | == Further reading == |
| 107 | |
| 108 | * Git Cheatsheet: http://ndpsoftware.com/git-cheatsheet.html#loc=workspace; |