Lesson 7: Contribute to open source projects on GitHub
ShulyAvraham
Posted on February 26, 2023
Contribute to projects on GitHub
Contribute to dev.to
dev.to Is an open source project
We found an issue with auto save - so that when I write text, the system will automatically save it, or save changes but keep editing.
Built on Forem
Click the github link
Go to Issues
Before we open a new issue it is recommended to check if the issues was already addressed:
Use the Filters
to search for the issue. Search for 'autosave'.
Can also search Pull requests
or Discussions
Contribute to zarr-python
(https://github.com/zarr-developers/zarr-python)
Advance pull-request locally
E.g. I find that somebody sent a pull request with a solution to my problem, but it's not advancing.
I can advance that pull request on my end:
git clone <the project's github url>
Fetch the pull request by its number
git fetch origin pull/1357/head
git checkout -b b1357 FETCH-HEAD
Now I'm in a branch that contains the pull request code change.
FETCH_HEAD is a special file inside the '.git' folder, that was created when I run git fetch
and it contains the SHA of the pull request.
cat .git/FETCH_HEAD
Just like HEAD is a file which points to where I am currently located locally (which SHA).
cat .git/HEAD
Now I will merge the pull request with the main branch into a new branch
git checkout main
git checkout -b szabgab
git merge b1357
HEAD is a pointer to where I am currently in the git commits tree.
Git Conflicts
git merge <some branch>
Might cause conflicts. To resolve the conflicts, first locate the conflicting files:
git status
Edit the conflicting file:
vim <file with conflict>
Search for '>>>' or '<<<' and edit the file to resolve the conflict.
To cancel the merge that caused conflicts
git merge --abort
Docker for running the project
An example for a docker image created by @szabgab :
https://github.com/szabgab/mydocker
docker build -t mydocker .
An alias to run the docker
alias dr='docker run -it --rm --workdir /opt -v$(pwd):/opt mydocker bash'
dr
Tests
It is recommended to find out how to run tests locally. It is normally somewhere in the docs.
Tests coverage report
Codecov Report
During the tests run on GitHub or GitLab, the source code is being analyzed for which lines of code run as a result of the tests run, meaning those lines of code are being tested. A report is generated with the percentage of lines that are being tested (lines of code that run during the tests).
It is recommended that the code coverage be closest to 100%.
Some code may be deprecated, hence its not tested, so the code should be removed.
Or, perhaps a new function was added without a test.
Posted on February 26, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
September 6, 2024