How to use GitHub effectively as a Contributor?
3 min read
Whenever you get the opportunity to work on a project as a Contributor, meaning you have access rights to do almost anything with the repository. You must follow certain practices and etiquettes to make meaningful contribution without screwing the software development Life cycle and workflow and to reflect your professionalism by elegantly managing your role as a Contributor.
Starting as a GitHub Contributor
Just get started with your project by setting up the project locally cloning the main repo, using HTTPS method
git clone <repo_url>.git or Github CLI.
In case you are restarting your work as Contributor on a project, make a pull request to the main branch to make your local version up-to date with remote main.
git pull main
Before you start working
Before you start working on your local machine, it is better to checkout to a new branch to change you current branch so as to have a local main to go back in case of endless loop or unorganisable state of code and prevent any unwanted future push.
git checkout -b <new_branchname>
You can switch back to main or any other branch you created locally by simply
git switch <branchname>
When its time to commit your contributions
When you've added changes and made your contributions to the new branch you created, you want to give meaning to that contribution by pushing it to remote main. But, never ever directly push to main branch, it is best to follow this flow to commit your changes,
git add . git commit -m "<meaningful comment about changes you made or features you added>"
then you need to push these change to your remote branch that you created locally, It gives a certain confidence and a good second eye check on your code before actually pushing it to main.
git push origin <branchname>
Your commits will reflect on the remote repository on your branch and an option to create a pull request. While creating a pull request, take a look at changes and provide a little explanation about the feature or changes you added with respect to main branch in the comment section.
Don't use your ability to merge all the time
As a contributor, you got access to merge any pull request to the main, but do not excessively merge the requests to main. It may breakdown the workflow for other and then they need to update their local version more randomly. Alert rest of the contributors about the pending merges and announce about it before/after merge, so they don't have to work on the out-of date version of the product. This boosts your credibility and trust. Read more here
Keep your local setup up-to-date
Its clear to you about the changes you made, but to be reassured about the version you are currently working is up-to-date. Make sure to fetch the latest version of remote main and merge it with your local setup and reiterate the steps form step 2.
git fetch origin git merge origin/main
This basic flow of doing contributions may prove to be helpful to boost your effectiveness as a Github Contributor. Till then, keep coding and keep contributing. You can read more here
#contribution #github #community
Did you find this article valuable?
Support Agrit Tiwari by becoming a sponsor. Any amount is appreciated!