Git and GitHub workflow#
Note
If your not familiar with git you may want to start by reviewing
Git’s documentation and then trying
out the workflow. If you get stuck, chat with us on
Slack.
The preferred workflow for contributing to predictably’s repository is to
fork the main repository on GitHub,
clone your fork locally and create a development installation, and then create
a new feature branch for your development.
Fork the project repository by clicking on the ‘Fork’ button near the top right of the page. This creates a copy of the code under your GitHub user account. For more details on how to fork a repository see this guide.
Follow
predict-ably/predictably’s development installation instructions.Configure and link the remote for your fork to the upstream repository:
git remote -v git remote add upstream https://github.com/predict-ably/predictably.git
Verify the new upstream repository you’ve specified for your fork:
git remote -v > origin https://github.com/<username>/predictably.git (fetch) > origin https://github.com/<username>/predictably.git (push) > upstream https://github.com/predict-ably/predictably.git (fetch) > upstream https://github.com/predict-ably/predictably.git (push)
Sync the
mainbranch of your fork with the upstream repository:git fetch upstream git checkout main git merge upstream/main
Hint
You can use these same instructions to sync another branch by replacing the “main” branch with the name of the other branch you want to sync.
Create a new
featurebranch from themainbranch to hold your changes:git checkout main git checkout -b <name-of-feature-branch>
Note
Always use a
featurebranch. It’s good practice to never work on themainbranch. Name thefeaturebranch after your contribution.Develop your contribution on your feature branch. Add changed files using
git addand thengit commitfiles to record your changes in Git:git add <modified_files> git commit
When finished, push the changes to your GitHub account with:
git push --set-upstream origin my-feature-branch
Follow these instructions to create a pull request from your fork. If your work is still work in progress, make sure to open a draft pull request.
Note
We recommend opening a pull request early, so that other contributors become aware of your work and can give you feedback early on.
To add more changes related to this feature, simply repeat steps 7 - 8.
Note
Pull requests are updated automatically if you push new changes to the same branch. This will trigger
predictably’s continuous integration routine to re-run automatically.