The following contains the rules for how our team will use git throughout this project.
All additions to master will be done via branches and pull requests.
When adding code, create a new branch. Each new branch will be named with one of the following prefixes:
- feature_(name): to be used when creating a new feature
- update_(name): to be used when updating or changing an existing feature
- refactor_(name): to be used when refactoring some code
"name" should describe the code you are committing
In terms of commit messages, you message should at least have a verb and object describing the commit.
Once you commit all code to a branch and want to merge with master, create a pull request. Have a partner check your pull request. The partner can either merge the branch to give a LGTM (looks good to me) for you to merge the branch.
How to assess a pull request:
- Checkout the branch requesting to be merged.
- Run the code in the branch.
- Each subgroup should have its own method of code evaluation. J-Unit tests are a good option.
For example, suppose we wanted to add, update, and refactor a minimap to our project:
feature: initial creation of minimap
- create a feature_minimap branch
- code up initial minimap classes
- commit code to branch; a plausible commit message is "Created initial classes for minimap."
- do a pull request to merge this branch onto master
- have a partner check your code; they can either merge the branch or give you an LGTM for you to merge
- feature_minimap is now merged with master
update: updating minimap by making it observable (assuming feature_minimap has already been created)
- create an update_minimap_observable branch
- update the appropriate classes to make the minimap observable
- commit code to branch; a plausible commit message is "Updated minimap to be observable."
- do a pull request to merge this branch onto master
- have a partner check your code; they can either merge the branch or give you an LGTM for you to merge
- update_minimap_observable is now merged with master
refactor: refactor minimap to cut down on repeated code
- create an refactor_minimap_repetition branch
- refactor minimap classes
- commit code to branch; a plausible commit message is "Refactored minimap to cut down repetition."
- do a pull request to merge this branch onto master
- have a partner check your code; they can either merge the branch or give you an LGTM for you to merge
- refactor_minimap_repetition is now merged with master
In order for these standards to work, you MUST WORK TOGETHER WITH YOUR PARTNER!!! I know we all have our individual coding responsibilities. However, in order for the master branch to progress and people to move on with their work, we must have frequent pull requests, fixes (if needed), and merges. So, if your partner does a pull request, checking that pull request should be a top priority!
Only under specfial circumstances are you allowed to push directly to master. Under those circumstances, you will need permission from the majority of the group to submit to master.
The only changes which may be pushed to master are small documentation changes (i.e. adding netid, links, etc., to README).
When in doubt, always do a pull request.