First time contributing? Will help you out 🤝
Open-source contributions are a great way of learning and practically implementing your knowledge. But often the open-source newbies are confused in selecting the right projects for them to contribute, in creating relevant issues or making a pull request! Refer to the following articles on the basics of Git and GitHub, in case you are stuck:
If you don't have git on your machine, install it.
Basic Git Concepts ✅
Starting with the definition, Git is a free, open-source software which is used commonly used everywhere in the tech industry for version controlling.
Now, what is version control? It simply means managing different versions of a project/product. When multiple developers work on a project, they often distribute their work. Git which supports distributed version control system helps these developers to work (who would be working on different features of the project like UI, Database, etc) on the project simultaneously. Pushing the code (uploading the code on the server from where others can access it) by any of the developers doesn't affect the others. Because of this, if the owner of the project feels to keep an earlier version of the product for market use, he can easily access the older version. But this doesn't mean the newer versions of the product are lost. All the versions are managed properly by Git, which saves the history of all the changes or additions on the project and also tracks by whom they were done.
It means the project or the product whose changes we need to track using version control. It can be both public and private. Public ones are the ones which are accessible to the whole world and the private ones are accessible only to those to whom the repository owner has given permission. The extension of any repository is .git.
If I'm building my project, I'll be making it on my local system but later in future if I want my friends to collaborate or any enthusiast to contribute to my project, I'll have to share this project with them too. But how will I share? I can make a remote repository on GitHub or any other platform like GitLab which is based on Git. Then anyone can access the repository from there and contribute to my project.
Creating a branch in a repository means creating a new version of the project/ product but it is separate from the main repository. This is generally a good practice for the management of the code. As I said earlier, if many developers are working on the same project but on different features, they will create different branches with an appropriate name from the main repository. We can make a branch to solve an existing issue, for adding a feature or for adding enhancements to the project. You can imagine it like an upside-down tree with the main trunk being the main branch and all the other branches created as the ones grown out from the main trunk of the tree.
Now, if the purpose for creating branches is solved like if the code in my branch solves the existing issue in the main branch of the repository or the code in my branch is having better User Interface, then if the repository owner approves these changes, he/she merges this code with the main branch. Now, the changes which I made on my branch get merged with the main repository. Generally, the main branch of the project is kept production-ready.
When two or more developers work on different branches, their work gets approved and when they try merging their branches, sometimes Git is not able to do it as if the developers have changed the same file, Git gets confused about whose change to accept and merge with the main branch. So, in this case, the conflict arises. We need to solve these conflicts manually. After solving the conflicts, Git can easily merge all the branches into the main.
The Three git states-
As the name suggests, this means you have modified or added the files you wanted to add to the next version of the project but you haven't added them to the main repository, which is publicly accessible. It is also known as the working directory.
This area consists of all the files which you have modified in the current version and want in the next version of the product/project.
This means the code in our branch is saved and merged into the main repository.
💥 How to Contribute
Take a look at the Existing Issues or create your own Issues!
Wait for the Issue to be assigned to you after which you can start working on it.
Fork the Repo and create a Branch for any Issue that you are working upon.
Read the Code of Conduct
Create a Pull Request which will be promptly reviewed and suggestions would be added to improve it.
Add Screenshots to help know what this Script is all about.
How to make a Pull Request
If you think that you can add a new feature or want to fix a bug. You can start contributing by following the below instructions:
Create a folder at your desired location (usually at your desktop).
Open Git Bash Here
Create a Git repository.
Fork the repository.
Clone your forked repository of the project.
git clone https://github.com/<your_username>/repository_name.git
- Navigate to the project directory.
- Add a reference(remote) to the original repository.
git remote add upstream github.com/repository_owner/repository_name..
8. Check the remotes for this repository.
git remote -v
9. Always take a pull from the upstream repository to your main branch to keep it updated as per the main project repository.
git pull upstream main
1. Create a new branch (prefer a branch name that relates to your assigned issue). ```plaintext git checkout -b <YOUR_BRANCH_NAME>
- Perform your desired changes to the code base.
- Check your changes.
- Stage your changes.
``` git add . <\files_that_you_made_changes>
14. Commit your changes.
git commit -m "relavant message"
15. Push the committed changes in your feature branch to your remote repository.
git push -u origin <your_branch_name>
16. To create a pull request, click on `compare and pull request. 17. Add an appropriate title and description to your PR explaining your changes. 18. Click on `Create pull request.` [!(https://cdn.hashnode.com/res/hashnode/image/upload/v1644847940406/gDFBGeji2.gif)](https://camo.githubusercontent.com/b1bf3ec7eaf3453accfbbdbb744f7f0f1e3ba55c12bdc51bd0dc484036dde7ac/68747470733a2f2f6d656469612e74656e6f722e636f6d2f696d616765732f62353632646463666231333165393632663964666130316264333261333064312f74656e6f722e676966) Congratulations🎉, you have made a PR to the repository. Wait for your submission to be accepted and your PR to be merged by a maintainer. If you are looking to make your first pull request, you can try making one [here](https://github.com/aakankshabhende/Make-your-first-pull-request). If you have any doubts please let me know in the comments :)
Did you find this article valuable?
Support Aakanksha Bhende by becoming a sponsor. Any amount is appreciated!