Wondering how do I contribute to open source? Did you ever notice the Pull Requests tab when you visit some project on GitHub? Yeah, there lies the crux. Now assuming you know about Github, wait again? Assumptions are dangerous. So, let me know in the comments if you work on GitHub every day. Let continue with the assumption.
Prefer to watch instead of reading here you go:
Pull requests are the most used feature of GitHub. These are basically simple branches that get powered up (OP #gamers will know) to become candidates to enter the sea of code that our main
branch holds. You can raise any branch to become a Pull Request and that's why it's said 'raise a PR'. (OP #again). Now once you create a PR it will be peer-reviewed and then merged into the sea of code. Just like the titanic, merge conflicts are the icebergs
that we will need to resolve/dodge. This requires you to know the codebase in and out.
What is a merge conflict? Let's see.
Let's look at this PR from here: github.com/adityak74/test-open-source-app/p..
Let's look at these three commits in detail to understand what happened.
- This is the first commit. Adding two lines to the Readme file.
- Conflicting commit
iceberg clash
happens when the contributor tried to commit to the same file as the author modifies as well. - Now to resolve this merge conflict issue the contributor will merge the
main
branch from the author to his branch. This resolves the conflict and the PR is marked safe to merge. Note the lines 5,6 here!. These lines have been modified manually to resolve to one of the changes.
Finally, the PR is approved and merged.