February 20, 2020 • ☕️ 4 min read
When we love someone’s repository and would like to have it in our GitHub account, we fork it so that we can work with it separately.
When we fork a repository, we get an instance of that entire repository with its whole history. After forking, we can do whatever we want to do without affecting the original version.
Pull requests are the way we contribute to group projects or open source projects.
PR let you tell others about changes you’ve pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
Not only can we contribute to an open source project with code, but we can also contribute in many other ways. Some othe ways lists are below
Click on fork logo.
Open terminal or commant prompt and Type
git clone <repo url>
We need to go to that cloned directory by running this command:
cd <name of the repo>
It’s very important and real good practice to create branch while working with repositories. whether it’s a small project or contributing to a group’s work.
Lets create a branch using
git checkout command.
git checkout -b <branch name>
Now make some changes in existing file. We have readme file where we are going to make chnages and see how it works.
Here you can see I added one new line in readme file. Go to terminal/command prompt now.
Now add the changes and commit it.\
To add command is
git add .
To commit command is
git commit -m "commit details"
As we can see the remote name of this repo is
origin. After knowing remote now we can push our chnages easily.
Type this command to push the chnages:
git push origin <branbch name>
Here we can create our Pull request in two ways.
Please provide necessary details on what you’ve done (You can reference issues using “#”). Now submit the pull request.
Congratulations! You’ve made your first pull request.
If your pull request will be approved and merged in master branch, you will receive a mail as confirmation.
We will discuss more about and git and git hub in upcoming posts.
Share this post if you find this helpful.