DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Some of the Git commands you must know for open-source contribution.
lailahgrant
lailahgrant

Posted on • Updated on

Some of the Git commands you must know for open-source contribution.

For every developer out there, mostly the junior developers like me that want to improve their skills in this field of coding, should look more into open-source contributions & attending meetups at both local and remote level.

let's dive in:-
For a repository you want to contribute to (given that the issue is open and known to you, maybe - like after communicating to the mentor),

a) Fork the repository you want to contribute to.

  1. You should be logged into GitHub with your account.
  2. Find the GitHub repository with which you’d like to work.
  3. Click the Fork button on the upper right-hand side of the repository’s page.

b) Clone the repository in your command line.

git clone <repo_url>

e.g.

git clone https://github.com/lailahgrant/reactWork.git

c) Change location(directory) into the cloned repo

cd reactWork

d)create a branch(where you will push your changes & not to the master) e.g

git checkout -b lailah

lailah in this context is your branch name(branch name can be any meaningful name).

In case you make changes on the project, talk to the person and make a pull request(PR).

e) To check which branch you are on (you must be on your branch), Run

git status

f) To add all files you have changed, Run


git add .

g) Commit your changed with a meaningful message, Run

git commit -m "meaningful message about your changes"

h) Now it is time to push your changes to your branch, Run

git push origin lailah

or

git push --set-upstream origin lailah

Thanks for your time hopefully you found this article helpful.

Top comments (3)

Collapse
 
baliksjosay profile image
Joseph Balikuddembe

Wow thanks dear for this great write up, however some following up need to know how to finally submit his/changes to the main branch... I recommend a section for creating a pull request to the mantainer of the repo be added to this master piece

Collapse
 
lailahgrant profile image
lailahgrant

Thanks to all those that did DM their feedback on my 1st post & I'm surely grateful. The reviewed post I'm working on is dedicated to you all. Thanks again

Collapse
 
stuartelimu profile image
stue

Thanks so much for making this really simple, honestly I can now contribute to an open source project without googling every step

We want your help! Become a Tag Moderator.
Check out this survey and help us moderate our community by becoming a tag moderator here at DEV.