Git and Github

Github is like your class teacher, git is like your subject teacher and you being the code/record/file.

So, as it goes in the school hierarchy the same goes for git, GitHub, and code.

GIT: As your teacher keeps your record, git keeps the record of your code or file. As if the student improves or does anything teacher has the record. Similarly, the git keeps all the records of the addition/updation or deletion in the code/file.

GITHUB: Now, every subject teacher has a separate record for the students which is relevant to their subject and is given to the class teacher. Now the class teacher has the record of everybody about everything. Anybody can go to her and ask about anyone anything. Now, Github is exactly similar. I have some code, pushed to Github, anyone can come to see my code or even make his/her own changes with permission(that's a separate topic though).

Now a teacher has a memory and a file in which she can jot down the information. What does git has?

Let's introduce a new term,

Commit - It's like your signature corresponding to your work. The commit has two parts, 1) Commit Message - It is typed by you, i.e a message 2) Commit Id - It's given by the git automatically as you make a commit, which is unique.

There are some standards while writing the commit message. They are as follows: Add the following words at the beginning of the message.

  1. Feat - New Feature. E.g Feat - added a new level.
  2. Fix - For a fix.
  3. Docs - For changes made in docs.
  4. Style - Everything related to styling.
  5. Refactor - Code changes that neither change O/P nor Functionality.
  6. Test - Everything related to testing.
  7. Chore - Updating build task, package manager config.

The first time, when you push the code to GITHUB, a file called is created. What is it and what does a .md file contains, if you want to read about it. Click Here .

Repository: Okay, I have been using the word file/code/record for so long now. In Github, the file which has the project/file is known as Repository.

Branch: It's like every person has a separate room in the house. But, any person who comes to meet sits and has a conversation in the drawing-room. Similarly, a branch is like having a separate space work for every person/every feature. Any client/user that comes to the browser/your site just sees whatever code is there in the main branch. The main branch is the branch where everybody's code is merged and reflected on the site. A single person can also work on different branches for implementing versions to the site. E.g There is the main branch that reflects version 1.0 of your site. Now, you want to make a version 2.0, so to track the changes you make a branch from the main branch, and the users/clients would see only when version 2.0 is complete and merged to the main branch.

Pull Request(PR): PR comes handy when there are multiple people working on a project on multiple branches. So, when a person completes a functionality, to push it to the main branch that is reflected on the main site, a PR is raised to which the manager/co-workers review it, add comments, and then if it seems all correct then merged(added) to the main branch.

Did you find this article valuable?

Support Parull Kohhli by becoming a sponsor. Any amount is appreciated!