-
Notifications
You must be signed in to change notification settings - Fork 0
Contributor Workflow with Github
So you are going to contribute to kemia. Awesome! The following is our recommended workflow.
Contributors commit (frequently) code changes to their own fork of kemia, then push a ‘squashed’ single feature-based commit to the kemia development branch after testing it.
First, follow the Github instructions to fork kemia to your own public repository on Github. Of course, you will need to install git and setup your Github account.
Next, clone your fork of kemia to a convenient location on your local machine.
>git clone [email protected]:YOURNAME/kemia.git
>cd kemia
Now you are ready to start coding!
There are lots of tutorials on lots of ways of using git with your shiny new local repository. Here is a basic step-by-step for working on a new feature:
- Make a new branch for the new feature.
>git checkout -b implement_bread_slicer
- Code stuff.
- Checkin frequently with as many descriptive commit messages as you want.
>git status >git add [files] >git add [more files] >git commit -m "add finger guard to slicer"
- Write and Run unit tests for the new feature and to check for any regressions.
- Lather, rinse, repeat.
As your fork ages, other contributions will have been merged into the main kemia repository causing your fork to slowly become more and more out-of-date. Remember, the github Fork Queue is not the right tool for keeping your forks up to date.
You need to add the main kemia repository to the list of remotes for your local repo (here called ‘upstream’).
>git remote add upstream [email protected]:kemia/kemia.git
Make sure your repository is clean (no uncommitted changes) and is currently on the development branch. If not, commit or stash any changes and switch to the development:
>git checkout development
Then you can pull all the new commits from the main line:
>git pull upstream development
Remember, pull is a combination of the commands fetch and merge, so there may be merge conflicts to be manually resolved.
You may have commits that you want to publish to your forked repo on github to make them visible to other contributors before the new feature is complete and ready to push to the main kemia repository.
>git push origin development
When you are done with the feature, double check that everything is fine, it is easier to fix errors before you publish.
- Check the test suite, in case your changes broke any tests.
- Check if compiling raises any errors.
- Check for merge conflicts by bringing your repository up to date.
- If everything looks good with your new feature, then squash the commits into a single feature-based commit with an interactive rebasing (the kemia repo is called ‘upstream’ in this example) .
>git rebase -i upstream
- Push to the main kemia repository
>git push upstream development
- Send a quick email to the development team describing your cool new feature!