👍🎉 First off, thanks for taking the time to contribute! 🎉👍
When contributing to this repository, please first discuss the change you wish to make via issue or any other method with the owners of this repository before making a change. Please note we have a code of conduct, please follow it in all your interactions with the project.
- Generate your SSH keys as suggested here
- Clone the repository by typing (or copying) the following lines in a terminal
git clone git@github.com:UCL-CDI/cdi-hub.git
- Open an issue (bug report, feature request, or something is not working): https://github.com/UCL-CDI/cdi-hub/issues/new/choose
- Workflow for issue management
flowchart TD;
Z[Bug Reported] -->A[...];
A[Bug resolution] -->B(Testing OK?);
B--Yes-->C[Prepare commit];
B--No-->D[Reopen issue];
D----> A[Bug resolution];
C ----> E[Request Review];
E ----> F[Commit changes];
F --> H[Merge PR and close issue]
The following commands are typed or copied via command line. Alternatively, you can use the features of your integrated development environment (pycharm, code, vim, etc).
- Clone this repo
git clone git@github.com:UCL-CDI/cdi-hub.git
- Create new branch
{FEATURE_BRANCH_NAME}using issue number{ISSUE_NUMBER}
git checkout -b ISSUE_NUMBER-FEATURE_BRANCH_NAME #(e.g. `git checkout -b 422-my-feature-branch`)
- Commit changes and push to your branch
git add .
git commit -m 'short message #ISSUE_NUMBER' #(e.g. git commit -m 'adding a message to my feature branch #422'
git push origin ISSUENUMBER-branch-name
- Submit a Pull Request against the
mainbranch.
- Select branch that contain your commits.
- Click
Compare and pull requestand create PR for the associated branch. - Type a title and description of your PR and create PR
- Please keep your PR in sync with the base branch.
It is recommended that you use Squashing and merging a long-running branch.
Otherwise, you have the option to rebase your
{ISSUE_NUMBER-FEATURE_BRANCH_NAME}branch with the base branch (e.g.main).
git checkout main
git pull origin main
git checkout ISSUE_NUMBER-FEATURE_BRANCH #(e.g. git checkout 422-my-feature-branch)
git fetch
git rebase main
#git status
#edit conflicting files with your editor
#git rebase --continue
#git add .
git merge main
git push --force origin FEATURE_BRANCH
- Run
pre-commit run -ato tidy up code and documentation. - If you are developing in your local host, please check that your code is properly tested with
pytest. - Request a PR review. See collaborating-with-pull-requests for further details.
- Once your PRs has been approved, procced to merge it to main. See Merging a pull request
- Delete and remove your merged branch
9.1 You can navigate branches in https://github.com/UCL/ready/branches and removed merged branches by clickling 🗑️ icon.
9.2 Alternatively, you can delete your local and merged branches using the following commands:
#Local git clear
git branch --merged | grep -v '\*\|master\|main\|develop' | xargs -n 1 git branch -d
#Remote git clear
git branch -r --merged | grep -v '\*\|master\|main\|develop' | sed 's/origin\///' | xargs -n 1 git push --delete origin