What is GitHub?

Learn via video courses
Topics Covered

In the world of developers, where innovative tools and online services are the norm, the challenge lies in showcasing one's work to the global audience. Whether it's a personal project with real-life applications or a team collaboration seeking a platform to monitor progress and maintain project histories, developers need a space to share, collaborate, and discuss ideas. Enter GitHub, a powerful platform that serves as a hub for developers to exhibit their work, foster collaboration, and engage in meaningful discussions.

all about git and github

What is a Version Control?

It can be defined as a system that tracks all the changes and modifications a developer makes to a particular code present in a repository (a wrapper/home for a project).

A version control involves usage of some commands to carry out the operations on repository. It basically helps to keep a track of different versions of your code which really help developers to track progress, find issues or even in debugging . GIT is a famous Version Control System used by developers worldwide.

What is Git?

what is git

As we recently got to know that Git is a version Control System developed by Linus Torvalds in 2005. If you remember he was also the creator of a famous Linux O.S Kernel. Let’s dig in some more, is we be more precise then Git can actually be said as a Distributed Version Control System as a forked version of a project’s repository is also a repository that contains a full history of all the modifications made. Git is really powerful in terms of the security and flexibility it provides to its users.

After this much info about Git….

What is GitHub?

know what is github

Let’s bifurcate the term “Github” first:

GITHUB ⇒ GIT + HUB

So, simply it means that Github is a hub or a place where we can use Git. We will look into them more closely further in the article. Now, let’s dig into the definition.

GitHub is basically a website that helps developers to put their code online, it also tracks the changes that we make from time to time, in simple terms, it maintains a history for your project.

Even many organizations and companies put their codebases of large projects on Github, which are publically available to be accessed by the world, which also helps to encourage project management and collaboration between people all over the world.

Exploring the GitHub Interface

GitHub offers a user-friendly interface with various features to facilitate version control and collaborative coding. Let's explore some key components:

1. Repositories:

  • Create a New Repository:
    • Click on the "+" icon and select "New repository."
    • Set up your project by following the prompts.

Example:

Let’s create our first repository as it’s the most essential for starting any project.

git config email id

Click on the new button to get this interface

create repository

Simply add the repository name, check the box to add a README.md file for your repository, and then just click Create Repository

Finally, what we get is a repository for our project up and ready…..

my first repository github

2. Branches:

  • Create a New Branch:
    • Use branches to work on different versions of your project.
    • Create a new branch for a specific feature or bug fix.

Example:

3. Commits:

  • Make Commits:
    • Commits are snapshots of your project at a specific point.
    • After making changes, commit them with a clear message.

Example:

4. Pull Requests:

  • Submit a Pull Request:
    • Propose changes from one branch into another.
    • Collaborators can review, comment, and approve before merging.

Example:

  • Review and Merge a Pull Request:
    • Collaborators review changes and merge them into the main branch.

Example:

Explore each feature with these commands to effectively manage your projects and collaborate with others on GitHub.

How to Use Git And GitHub?

The first step is to visit GitHub

how to create a profile on github

Simply create an account by choosing your username and verifying your email and other credentials.

The second step would be to install GIT on your local machine according to the Operating System you have from here.

After setting up GIT in your locals the next step would be to go to your Command Prompt or Terminal to set your essential credentials on GitHub for any repository

Use the following commands:

Make sure to enter your GitHub username in place of <your_user_name>

Make sure to enter your Email Id in place of <your_email_id>

Now you can create your first repository using the above-discussed commands as it is the most essential step for starting any project. The repository will act as a wrapper, containing all the files necessary for the project.

How to Get Started with GitHub?

Let’s move to the most interesting part i.e. how to work on GitHub.

For this, I will depict the whole process with images to help you understand better

Now, you need to understand two scenarios

  1. You are working on your own repository
  2. You are working on someone’s else repository

The steps for both will be the same except for 2., when you are working on someone else’s repository. In this case, you just need to fork or create a copy of that repository in your profile repositories.

It’s like photocopying of the original documents. Let’s see how it’s done:

forking for github profile

I just clicked on Fork to create a copy of this repository of mine

Note: Am doing this forking from my friend’s Github profile, not mine. The fork is always done on someone else’s repository.

Now, see how it looks in my friend’s profile

fork is always done on someone else repository

The image clearly shows how the same repository is in my profile

Let’s move to the common steps:

(i) Cloning / Downloading the Repository on Local Machine

This step just requires clicking the Code button in green

downloading the repository in local machine

(ii) Open Terminal/CMD of Your Local Machine

Simply do the command

git clone the link you copied

Just open this folder Social-Site-Blocker in your favourite code editor. I prefer VS-Code

(iii) Make changes

make changes

The left is the original text and the right is the text with changes

(iv) Add, Commit, and Push the Changes

add commit and push the changes github

Commands are:

  1. Git add . To add all the changes made to the original code

  2. Git commit -m “ commit message “ Commit all the changes with a clear message

  3. Git push Push all the changes to the forked version of the repository

(v) Create a Pull Request or PR (This step will only be done when contributing to someone else’s repository)

Simply go to your forked version, there you will find a prompt box by Github to Compare and Pull Request.

create a pull request in github

compare and pull request

Now, I will simply go to my profile to review my friend’s Pull Request and simply merge it and all the changes he made to his forked version will now also be seen in my repository.

social site blocker github

Finally, we learned how to make changes and contribute to a repository.

hurray

How to Promote Your Profile on GitHub?

GitHub is a very engaging platform where as a developer not only can you learn and polish your technical skills but also showcast it to the world. The customized profile README about which I told earlier can be simply made by creating a new repository and naming it as:

Your_username.md

Let’s Look at an Example:

create a new repository in github

Simply, you just have to write markdown code to create your own profile README to showcase your skills, tech stack, accomplishments, etc.

write markdown code in github

GitHub’s Competitors

Following are some platforms that give tough competition to Github:

(i) GitLab

gitlab

(ii) Circle CI

circleci

(iii) Jenkins

jenkins

(iv) BitBucket

bitbucket

Conclusion

We have covered everything about Github, right from the basics to creating repositories and hosting your code. I conclude by saying that all the worthy knowledge gained through this article will be more than enough for an individual to kickstart his Github journey.

Read more about GitHub at Scaler's Git Topics.

All the Best !!!

See More