DEV Community

ShulyAvraham
ShulyAvraham

Posted on

Lesson 7: Contribute to open source projects on GitHub

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>
Enter fullscreen mode Exit fullscreen mode

Fetch the pull request by its number

git fetch origin pull/1357/head
Enter fullscreen mode Exit fullscreen mode
git checkout -b b1357 FETCH-HEAD
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Just like HEAD is a file which points to where I am currently located locally (which SHA).

cat .git/HEAD
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

HEAD is a pointer to where I am currently in the git commits tree.

Git Conflicts

git merge <some branch>
Enter fullscreen mode Exit fullscreen mode

Might cause conflicts. To resolve the conflicts, first locate the conflicting files:

git status
Enter fullscreen mode Exit fullscreen mode

Edit the conflicting file:

vim <file with conflict>
Enter fullscreen mode Exit fullscreen mode

Search for '>>>' or '<<<' and edit the file to resolve the conflict.

To cancel the merge that caused conflicts

git merge --abort
Enter fullscreen mode Exit fullscreen mode

Docker for running the project

An example for a docker image created by @szabgab :

https://github.com/szabgab/mydocker

docker build -t mydocker .
Enter fullscreen mode Exit fullscreen mode

An alias to run the docker

alias dr='docker run -it --rm --workdir /opt -v$(pwd):/opt mydocker bash'
dr
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)