Contributing code - How to Commit Code

Contributing code to Raxa JSS EMR

We would like more and more people to contribute to our project. Please follow the following guidelines for contributing code, so that it is easier for you as well as us to quickly get your code merged into our repositories.
 
Although we would like people to contribute code in whichever way they can, it will be really really considerate if instead of attaching patches to tickets, you can fork our github repository and code is submitted through pull requests.
So, you will have to create two ids. Doing this with the same email address is optimal, but not mandatory:

  1. raxaemr.atlassian.net (Sign up)
  2. github.com id (Sign up)

Following are the steps to follow:

  1. Fork one of our github repos, depending on what code you want to contribute to: https://github.com/raxa/repositories 
  2. Select one of the tickets (OPEN status) for which you want to write code - https://raxaemr.atlassian.net 
  3. Assign yourself to the ticket and ask questions regarding design. If there is no design, please create design diagrams by communicating on the dev list
  4. Clone your github fork locally (hint: git clone <your fork>)
  5. Write code (by following Coding Standards) and commit locally with the ticket number as part of your commit message (hint: git commit -m “RAXAJSS-91 - I made something”). This will help automatically linking your work on the ticket after we merge things.
  6. Change the ticket status to IN PROGRESS
  7. Push the local commit to your own fork (hint: git push)
  8. Also write something meaningful to the ticket comment about commit to your own fork. That way people are updated that you are working on something and gives early access to other developers. In the lines of 

    Commit: {commit_id}
    Author: {author name}
    Date: {timestamp}
    Message: {commit_message}


  9. Make additional commits with the same steps as mentioned 5-7.
  10. When the work on the ticket is complete, make a pull request (hint: in github.com click on Pull Request). This will create a pull request that core developers can review and merge.
  11. Code can be reviewed in 2 ways, depending on the complexity of the feature. Core developers should write a summary of their reviews in the ticket comments:
    1. pre-merge - When pull request is submitted, core developers will review code by looking for changes, running tests etc. This is useful for simple features or code that is not integrating with many components/pages
    2. post-merge - The pull request is merged by core developers, but reviews are done in crucible (https://raxaemr.atlassian.net/source/cru/) because these involve integration tests, debugging code and checking how things are actually running
  12. If there are no more code changes required and ticket has been suitably completed along with testing, the core developer who merged the code should change the ticket status to CLOSED

Other things to remember

  1. Merge code changes with the Raxa branch often
    1. Add the main Raxa respository as an upstream with the read-only link. (for client app repo, hint: git remote add upstream git://github.com/Raxa/Raxa-JSS.git)
    2. Get the code changes (hint: git fetch upstream)
    3. Merge with your local fork (hint: git merge upstream/master)
    4. Push the merged changes to your github fork to be updated (hint: git push)

  2. Commit code with Unix-style line-endings (default - but usually a configuration when installing git)

Want to undo a commit and roll back your changes? (NOTE: will DESTROY your latest changes, backup your files.)

  1. First, back up your local files if you don't want to lose your work.
  2. Next, open Git Bash and navigate to your project folder
  3. type git reset --hard <commitID> where the <commitID> is the commit you want to revert TO
  4. type git commit -m "rolling back changes"
  5. type git push -f