My Open Source Cheat Sheet

My Open Source Cheat Sheet

Fork your open source project you want to contribute into your GitHub and clone your fork.

git clone git@github.com:dcnis/mockito.git

Show current configured remote repositories. The origin repo points to your fork on GitHub.

git remote -v
> origin  git@github.com:dcnis/mockito.git (fetch)
> origin  git@github.com:dcnis/mockito.git (push)

In order to fetch the updates from the open source project itself, you have to first add another remote usually called upstream.

git remote add upstream https://github.com/mockito/mockito.git

Now you have two remotes

git remote -v
> origin  git@github.com:dcnis/mockito.git (fetch)
> origin  git@github.com:dcnis/mockito.git (push)
> upstream        https://github.com/mockito/mockito.git (fetch)
> upstream        https://github.com/mockito/mockito.git (push)

Fetch new updates from upstream and merge them into your local main branch

git fetch upstream
git merge upstream/main main