Beginning with GitHub

Hello Everyone,

Today I will tell you some basics of GitHub, (from filing of an issue to solving it and pushing the changes to owner via pull request) from my personal experience!

I was looking over the filer repository in the GitHub and after going to bit of details I found that the code used to write the files was old JavaScript style which was using var almost in every other file.

So, I decided to break the chain of using var and change them to latest type of declaring variables which is let/const (know about it more).

To let developer know that I am working on it, I created an issue. You can easily create an issue by going under the issue section and click “New Issue” button.

Once the issue was created I was ready to get started, first I forked the original branch (know about branches and flow) using the “Fork” button, it creates a copy of the repository under your profile.

I copied the remote repository to my local using: git clone /path/to/repository

Now you can use any Editor you like to make changes in the code. I used Visual Basic Code.

With the help of command line in visual basic code, I created a branch because I didn’t want to mess with the master branch because as If I mess up anywhere I could always compare with master and I will come to now what was the original. We can create a branch using: git checkout -b “BRANCH-NAME” (-b is used to let know its a new branch), if you will not use -b it will actually try to change your branch, which could give you an error, as it will not be there yet. So, git checkout “BRANCH_NAME” will change the branch and with -b it will create a new one.

I made the changes and my code looked like this ->

I ran some test which helped me letting know that I didn’t mess up. ( List of tests), I successfully passed all the tests and now I had to push the changes to my remote Git.

To push the changes to git,

  1. I need to create a local git repository called “.get”. (command -> git init).
  2. Then I commit changes in to it. To commit first I will need to put the changes in the staging area (command -> git add “PATH” [ “PATH” over here means the path to the file where changes were done]). Once the changes are in the staging area, use git commit -m “MESSAGE” to commit the changes into local git repository.
  3. After, I pushed the changes to my remote git. (command -> git push origin BRANCH_NAME).

If you did everything right, changes you did locally you will be able to see those changes on your remote. This is how mine looks:

Now I was ready to send a pull request to the developer, you can simply do it by clicking the pull request in your remote repository.

Once you click “Pull request”, it will take you to the below page where you will be able to be see what are the differences, in my case, you will nothing as I already did it but in yours you will see the differences. (still I will put the screenshot)

From this page you will be able to submit your pull request.

I also reviewed other people pull request, how they did it, it give you a very good idea how people look at code and tries to get it to its best performance.

Now to see if you are getting familiar with GitHub, go and try locate the screen shown below Filer (This is just one repository you, can find it anywhere).

Hope you like my post, if you think anything could be made better, your opinion will be much appreciated!