To Begin With……
If you are a seasoned dev you can skip this. Believe it or not, it actually took a long time for me to figure out how to contribute to open-source projects. I wanted to use this as a primer and as a reference to send to people when they inevitably ask ‘What is a PR?’ or ‘How do I create a PR?’
Introduction
A pull request is how a developer can add changes to a codebase using a version control framework. In open source communities, a pull request is like a welcome handshake, it will determine first and foremost if your code will be added to the repository and will leave an impression on the other contributors who will decide if they would like you to contribute to future work. These are some items I wish I knew before diving head first!
Terms
Open Source: Open source means anybody is free to use, study, modify, and distribute your project for any purpose. These permissions are enforced through an open source license.
Version Control: Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
Repository: A Git repository is the .git/
folder inside a project. This repository tracks all changes made to files in your project, building history over time. Meaning, if you delete the .git/
folder, then you delete your project’s history.
Branch: a branch
is a new/separate version of the main repository
Commit: Adding commits keep track of our progress and changes as we work. Git considers each commit
change point or "save point". It is a point in the project you can go back to if you find a bug, or want to make a change
Git: Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
GitHub: GitHub is a code hosting platform for collaboration and version control. A GitHub repository can be used to store a development project. You can think of it like a UI for Git.
Fork: Forking is creating a clone of the current repository.
and of course ⬇️
What is a Pull Request
When a group of people are contributing to a development project, to keep the main code that is operational clean and working, there is a standard set of rules that takes place. We will simplify this a lot for brevity and to help give context to our goal - Creating our first PR
When we would like to add a feature or fix a bug in the production code(main branch) these are the steps we follow:
We create another branch
Write our changes
Test
Merge back into the main branch
Creating your First Pull Request
I learn by doing so I have set up this interactive tutorial to get you creating your first PR. You can find the Repo here and feel free to comment, ask questions and interact as much as you would like.
This tutorial assumes that you have a Github account, VSCode installed and know what the terminal is. If you feel setting up your environment would be a useful article drop me a message.
Fork the repo by going to this [link](https://git clone https://github.com/0xzoz/pull-requests-with-zoz.git) and clicking the fork button at the top right
Clone the pull-requests-with-zoz repo
git clone https://github.com/<your-username>/pull-requests-with-zoz.git
Create a new branch to add your changes
git checkout -b add-new-name
Navigate to the root(the top-level directory in a folder structure) and there will be a file named
Letsgooooo.md
. Open it and add your GitHub handle( eg @0xZOZ) and a sentence.
5. Add and Commit the code to the branch
git add .
- This is adding all the changes that have been made within the repository
git commit -m ‘Add yourname to file’
- This stages all the changes to the current branch with a message about those changes.
6. Push the changes and branch to Github. git push
this will result in an error and will give you a command similar to the following because it is the first time you add the branch to the repo
git push --set-upstream origin add-zoz
7. Navigate back to your forked repo. You should now see a little banner at the top of the page like this
8. There is a template that will be similar to what you see when you are contributing to open-source projects. Take note of the branch you are merging into eg you want to merge the add-zoz
branch into the main
branch
Congratulations!!!! You just submitted your first PR. I hope this helped you get started, you are now ready to start diving into the pull-requests-with-zoz
series
What is the pull-requests-with-zoz series?
This series is for the curious potential web3 coders out there. I, like you, started with a vision that blockchain and web3 will change the world yet I didn’t have the skill set to actively help build that world we so long for.
pull-requests-with-zoz will help anyone of any skill set learn about a product, project or discipline in a new content form I felt would be beneficial for others. It consists of two complementary pieces:
A pull request that was contributed to an open source crypto project
An article explaining the what, why and how.....
The series will be in no specific order but as more PRs get completed, the collection will be bundled into focused groups as the content grows.
Breakdown
Each article will have the following structure:
Motivation
Tech/Product
Pull Request Reference
Scope
Breakdown of commits
What is happening in each one
Why design decisions were made
Issues
Conclusion
Why
I started developing open source software with not much knowledge. It was a huge step to be able to send my first PR(one line of code lol). With each PR, I get a little bit better at understanding these new technologies. While it takes me more time than it should. If I can give back to help others understand concepts faster. It makes me feel like those extra hours were worth it.
These are for me as much as they are for you. I am by no means an expert and writing these down for others helps me grasp the concepts. There will be errors but there will also be valuable gems that will help breed the next cohort of everyday cypherpunks trying to change the world.
Learn how to send your first pull request and how the pull-requests-with-zoz series will guide you through some pull requests to open source Web3 projects
https://paragraph.xyz/@0xZOZ/pull-requests-with-zoz
Cover Photo
The image above(like my PP) is created with abraham.ai - an AI artwork generator SEED: zoz.eth sending a pull request
About
Twitter: @0xzoz
GitHub: @0xzoz
Mirror: @0xzoz
Discord: @zoz.eth#6952
ENS: zoz.eth