Creating a Pull Request on GitHub.

Introduction: Today, I am going to explains the steps I took to contribute to a project. Right from forking the project to creating a pull request. Although, it is a small project and all I had to contribute to the project is to add my name as required.

So, let's jump on it.

Again, below are the steps I took.

  • I forked the project: A fork is more like a copy of the project which will now be your repository.

image.png

  • I cloned the project in my terminal using the git commands below.

git clone <url of the forked repository(my repository)> <folder_name: optional>

If you omit the folder name to clone the repository to, the name of the repository is used by default as the folder name.

  • I moved into the folder

cd folder_name

  • I set the original repository which is the repository I forked as my upstream repository.

git remote add upstream <url of the original project>

  • I opened the folder on my default code editior to make some contribution using.

code .

  • I added all the changes I made

git add . or git add -A

  • I commited the added files to get them ready for pushing.

git commit -m <commit message>

  • I pushed the committed files

git push --set-upstream origin <branch name>

On pushing, to create a pull request, I have two options

  • Using the link I get in the response body which will take me to where the PR willl be created,
  • Going to GitHub to create a PR manually

You can as well describe the changes you had made in the description section of the PR.

Some other commands you might need are listed below.

If you feel you don't want to edit the master branch, you can create a new branch using

git branch <branch_name>

To make use of the newaly created branch, you need to switch to it using

git checkout <branch_name>

To perform these two action at once, use

git checkout -b <branch_name>

...