With the Hacktober Fest 2022, it is important to learn how to fork and clone a repository so you can make valid changes and later make a pull request. This article is for beginners who are confused as to how we can contribute to the open source.
You know the basic git commands which I have discussed in my article named — Git: The Basics. However, contributing to other people’s repositories might be tricky if you’re new to it. So, let’s start with the way to fork the GitHub projects. For that reason, I have made this short guide for you.
First, visit the repository you want to fork and work on. You can see the option fork in the figure below: -
This will create a copy of the above portfolio in your profile under your username as: -
https://github.com/<username>/<repo_name>
Now, we need to bring the repo to your local device with the help of the following command: -
git clone https://github/<username>/<repo_name>
This would download all the code, branches, and commits from the original repository to your device. Then, we need to do some things that are explained below: -
- Creating a new branch
git checkout -b branch_name
- Creating a new remote for the upstream repo with the command (Not always required)
git remote add upstream <original repo_name>
- Then, you can make changes in the code and the usual push operations: -
git add .
git commit -m "the changes"
git push -u origin branch_name
After this, you can go to your GitHub repo you forked earlier and then click the “compare and pull request” button and you will be redirected to a screen where you can also add comments for the request and you can finally create a successful pull request which the maintainer will see and review to decide if they want to merge the changes.
pragyaasapkota / Git-and-GitHub
A blog repo for the concepts of git and github.
Git and Github
Git is a free open-source version control system. It is used by most developers and programmers these days since this is easy and more efficient than other version control systems.
GitHub is a website that hosts your repositories online. Many people might get confused about this term, but it is just a service that holds your code in repositories. And by its name, we can guess that it is the hub for git. As a matter of fact, this is the largest open-source codebase for all the users around the world.
This is a index for content related to git and github.
If you wish to open these in a new tab, Press CTRL+click
S.N. | Table of Content |
---|---|
1. | Git: The Basics |
2. | Pull Request in GitHub |
Thank you!!!
I hope this article was helpful to you.
Please don’t forget to follow me!!!
Any kind of feedback or comment is welcome!!!
Thank you for your time and support!!!!
Keep Reading!! Keep Learning!!!
Top comments (1)
I am really impressed along with your writing abilities as well as with the format for your blog. prayer for court cases