-
Notifications
You must be signed in to change notification settings - Fork 8
Contributing to the Code
The code is shared among all instruments this means that you need to be careful when editing the repository. In general once a feature is released try to only change the interface in a backward compatible way. For example when adding a parameter to a function call add a sensible default which replicates the original behaviour.
In general you should not need to change code in instrument
folder except for your own instrument. Any other code is potentially shared, try to leave good commit comments to explain what you were doing.
Development should be done on feature branches usually from the latest version of the code. This means several features can be developed independently and only committed at the point that the code is working. The process for doing this is:
- Checkout master branch
git checkout master
- Update to current version
git pull
- Create a branch
git checkout -b "<branch name>"
- Push this to the server with
git push --set-upstream origin <branch name>
This has created a branch on which to work, this will not effect anyone else but the code can be freely stored and shared with others if required.
Once you have started a change and are on your feature branch you can now edit the code. Best practice is to make lots of small changes and to commit the changes to the branch as you go. At the end of the commit the code should be runable but may not do everything you want it to. To commit the code:
- Find out which files have changed
git status
- Find out changed
git diff
(use up and down arrows and q to quit) - Add files you want to include, either:
- Add all tracked file
git add -u
- Add all changed files including untracked files
git add -A
- Add a specific file
git add <full path of the file>
- Add all tracked file
- Check what will be committed
git status
those in green will be committed. - Commit the changes to local repository
git commit -m"<message describing commit> (<your name>)"
- Push the changes to the central repository
git push
Finally you need to put your changes back onto the master branch. The easiest way to do this is to create a pull request.
- Go to the code in git hub.
- Click "New Pull Request Button"
- Select your branch
- Add any details and click ok
Ideally you now send the pull request to someone else to review. They should review the changes and if they are happy:
- Click "Merge pull request"
- Add a comment and then click "Confirm merge"
- The click "Delete branch"; this removes the branch as an active branch it can be restored later if needed.