-
Notifications
You must be signed in to change notification settings - Fork 182
Get Started with FHIR on GitHub
Starting on September 7, 2018, the core development of the FHIR specification is moving from GForge/svn to GitHub. The subversion repository will become read-only on September 7, and the GitHub repository will be available for writes by September 10. If you've been committing to the specification via svn, here's what you need to know about the transition. Please note that over time, we'll be looking at better ways to incorporate code review and approvals as steps in the process of developing the specification, especially to protect normative content from undesired changes. For now, though, we're adopting the committers model we had in svn, where community members agree to a set of common standards about when and how edits can be made.
-
Please sign up for GitHub and let us know your GitHub username so we can ensure you're a member of the right teams (i.e., so we can give you the permissions you need to commit). To do this, just send a message to the "GitHub Usernames" stream of #committers listing your username. For example, my message just says "I'm
jmandel
". (Pro tip: put your username between back-quotes to format it with a monospace font.) -
Download and install a git client for your operating system. There are myriad clients available, each with different selling points — but for consistency, the instructions here will assume you're installing the standard, open-source
git
command-line client. For details on how to get started, follow the instructions at https://git-scm.com/book/en/v2/Getting-Started-Installing-Git. -
Clone the FHIR specification from GitHub by browsing to https://github.com/hl7/fhir, and choosing "Clone or download". You can clone using HTTPS, in which case you'll need to enter your username and password each time you connect; or you can set up ssh keys to automatically authenticate (details here).
Now that you have a local clone of the FHIR spec, you can get to work making the spec better :-) Here, we'll work through a quick example of how to submit a change.
-
Make sure you're up to date with the latest master branch for the FHIR spec as a starting point for your changes. I can make sure I'm on the master branch via
git checkout master
and make sure I'm up to date with the latest viagit pull
. -
Create a local branch for your work, with a descriptive name. A best practice is to prefix your branches with your github username. So for example if I wanted to propose an update to FHIR's
history.html
page to indicate the move to github, I might dogit checkout -b jmandel-history-with-git
to create a branch namedjmandel-history-with-git
where I'll be doing my work. -
Next, edit the files you need to edit; in my case, I might use a text editor to make these changes, so I'd run something like
vim source/history.html
to make and save my changes. -
Now, review your changes. To see what files have changed, you can run
git status
; to see a diff you can rungit diff
. A full tutorial on git is beyond the scope of this guide, but https://git-scm.com/book/en/v2 provides an excellent starting point. -
Run the FHIR build tool to make sure you haven't inadvertently introduced any errors in the process of your edits. The full detail on getting set up are available at https://confluence.hl7.org/display/FHIR/FHIR+Build+Process — but if you've previously been making commits to FHIR via subversion, you should be all set up and you can just run
./publish.bat
(in Windows) or./publish.sh
(in Mac or Linux). -
If everything looks good, you can commit your work. First, add any files that need to be committed via
git add
. (In the case of this example, I'd dogit add source/history.html
. Pro tip: usegit status
to see what files have changed) Then you cangit commit
to commit your changes. You'll be prompted for a commit message, who should be a short, descriptive explanation of the changes you've made. You can also supply this message directly via the-m
flag, so in this example I might dogit commit -m "Add GitHub links to history.html"
-
Make sure that the main branch has not been updated in the meantime, by repeating step 1.
-
Merge the main branch into your feature branch name:
git checkout feature_branch_name
(in this example, that'd begit checkout jmandel-history-with-git
), followed bygit merge master
. If you encounter conflicts, these must be resolved. -
Repeat step 5, running the FHIR build tool, to make sure the merge from step 8 was successful.
-
If everything looks good, you can push your changes up to GitHub via
git push -u origin feature_branch_name
. (In this example, that'd begit push -u origin jmandel-history-with-git
). -
Create a "Pull Request" in GitHub to get your changes merged. To do this you can browse to https://github.com/hl7/fhir where you should see your recent change flagged at the top of the screen with a "Create pull request" button. (If not, just click "New pull request" and choose your newly pushed branch as the "compare:" branch.
-
Once you complete the request by clicking the green "Create pull request" button, you'll see that status checks are pending. These status checks ensure that your branch is up-to-date and that your proposed changes have not introduced any build errors. (Behind the scenes, the FHIR build tool's
publish.sh
is running on a cloud server, just as it did on your local machine in step 5 to check for errors.) -
Once status checks have completed without errors, you will be able to merge your pull request into the
master
branch. Just after you merge, you can click "Delete" in GitHub to delete your now-merged branch.
For a truly tiny specification change, like correcting a simple typo, it's possible to complete the editing and pull request process from directly within the web browser.
-
Navigate to a page that has a typo, like https://github.com/hl7/fhir/blob/master/source/history.html. Then click the pencil icon ("edit this file") and make changes inline.
-
At the bottom of the screen, add a description outlining your changes, and choose "Create a new branch", giving it a descriptive name. A best practice is to prefix your branches with your github username. So for example if I wanted to propose an update to FHIR's
history.html
page to correct a spelling error, I might name the branchjmandel-history-typo
. -
Complete the form by clicking "Create pull request", following the instructions starting at step 9 in the detailed outline above.