|
|
|
# Introduction
|
|
|
|
|
|
|
|
At a high level, the model is as follows. All alterations to the organization repository (this one) are made via Pull Requests. Developers work in branches in their local repositories (<username>/autocnet). Changes are pushed to the user's branch then PRed (pull requested) in. One of the other developers on the project will merge a PR to ensure that high level code review is occurring, the Continuous Integration (CI) tests are passing, etc.
|
|
|
|
|
|
|
|
# Initial Setup
|
|
|
|
* Create a Github account
|
|
|
|
* Fork the [USGS-Astrogeology/autocnet](https://github.com/USGS-Astrogeology/autocnet) repository
|
|
|
|
* [Forking article](https://help.github.com/articles/fork-a-repo)
|
|
|
|
* Clone the forked repository using `git clone https://github.com/jlaura/autocnet.git change `jlaura` to yourUsername
|
|
|
|
|
|
|
|
# Development
|
|
|
|
On the local (laptop or desktop) execute the following to begin working on a bug or enhancement
|
|
|
|
|
|
|
|
|
|
|
|
1. Add an upstream remote repository pointing to the USGS Astrogeology organization repos
|
|
|
|
```git remote add upstream https://github.com/USGS-Astrogeology/autocnet.git```
|
|
|
|
2. Pull from upstream to get the latest master
|
|
|
|
```git pull --rebase upstream master```
|
|
|
|
1. Create a branch on your client
|
|
|
|
```git branch bugfix```
|
|
|
|
where ```bugfix``` is the name you want to use for the branch.
|
|
|
|
2. Switch to this branch
|
|
|
|
```git checkout bugfix```
|
|
|
|
3. Make your changes. Note that before doing a pull request (below) you also want to ensure that any changes that have been accepted upstream can be integrated with any changes you are making now. So be sure to
|
|
|
|
```git pull upstream master``` into your working branch.
|
|
|
|
4. When you are happy with your changes run the tests on your client
|
|
|
|
```nosetests autocnet/``` where `autocnet` is the toplevel directory of your code base in the branch. You need to be in the toplevel directory, so if you cloned into ```/home/user/code/autocnet``` you need to run nosetest from within ```/home/user/code/autocnet```. If you also wish to run the code coverage tools instead run ```nosetests --with-coverage --cover-package=autocnet```. ([nose-exclude](https://pypi.python.org/pypi/nose-exclude) is required to run the tests: ```pip install nose-exclude```)
|
|
|
|
5. If the tests pass you can push the branch to the `autocnet` repository on *your* personal GitHub account
|
|
|
|
3. Check which files have been changed
|
|
|
|
```git status```
|
|
|
|
4. Add the files that you want to go into a pull request with
|
|
|
|
```git add file1 file2```
|
|
|
|
5. Commit your files
|
|
|
|
```git commit -m "SOME MESSAGE"```
|
|
|
|
5. Push your changes to your PySAL repos on GitHub
|
|
|
|
```git push origin bugfix```
|
|
|
|
|
|
|
|
## Pull Request
|
|
|
|
|
|
|
|
- After you have pushed your branch up to your personal GitHub account, you can issue a pull request on GitHub. Details on how to do so are described [here](https://help.github.com/articles/using-pull-requests).
|
|
|
|
- If the pull request is closing an issue, include a comment with ```fixes #issue_number```. This comment will close the issue when the pull request is merged. For more information see [here](https://github.com/blog/1506-closing-issues-via-pull-requests)
|
|
|
|
- If your pull request has been reviewed, merged and closed, your contributions will now be in the organization master branch
|
|
|
|
- At this point on your client you can go ahead and delete the branch
|
|
|
|
```git branch -d bugfix```
|
|
|
|
- You will also want to pull from the organization master branch to have these changes reflected in your local (laptop/desktop) master branch:
|
|
|
|
- ```git checkout master```
|
|
|
|
- ```git pull --rebase upstream master```
|
|
|
|
- Then push from your local client to your GitHub account
|
|
|
|
```git push origin master```
|
|
|
|
- At this point the three master branches (one on organization, one on your GitHub account, and one on your client) are all in sync.
|
|
|
|
- Move on to the next feature or bug fix.
|
|
|
|
|
|
|
|
# Credits
|
|
|
|
Large portions of this SOP are copied from the wonderfully organized and managed [PySAL SOP](https://github.com/pysal/pysal/wiki/GitHub-Standard-Operating-Procedures). |
|
|
|
\ No newline at end of file |