Browse by Domains

What is GitHub?

If you are a beginner who doesn’t know what GitHub is and how to use GitHub, then this blog is for you.

Let’s understand first how this comes into the picture.

Everyone has experienced this, how many times have you written a document — an essay perhaps — where we think we have got to our final version and called it EssayFinal, only to read through it again and spot some errors, so we rename it EssayFinal2. Perhaps it’s a dissertation, and we give it to our supervisor who has some comments, so we end up with EssayFinalRevised. Perhaps we now realize it’s too long so delete some stuff and create EssayFinalRevisedCut. Then we read it again and realize that we really need to add something back from an earlier version as it no longer makes sense. Later we realize Oh wait… did we keep that earlier version?

Git is designed to handle exactly this sort of situation. Unfortunately, it doesn’t work that well with ‘binary’ files like the .doc or .docx files that word uses, but for plain text files of the sort we use for writing programs and scripts, it removes these sorts of problems completely. Git is a part of GitHub which helps in hosting source and version control.

You must be thinking about what this version control is all about. Let’s get the knowledge first: what is this and what do we need?

Why do we need version control?

Have you ever:

  • Made a change to code, notice it was a mistake and wanted to revert back?
  • Lost code due to some reason and didn’t have a backup of that code?
  • Had to maintain multiple versions of a software project?
  • Wanted to see the difference between two (or more) versions of your project code?
  • Wanted to prove that a particular change in code broke the application or fixed an application?
  • Wanted to review the history of some part of the project code?
  • Wanted to submit a change to someone else’s(team member) code?
  • Wanted to share your code, or let other people work on your code as a team?
  • Wanted to check how much project work is being done, and where, when, and by whom?
  • Wanted to experiment with a new feature without interfering with working code?

In these scenarios and no doubt others, a version control system comes into the picture and makes your life easier.

Key points:

  • Backup
  • Collaboration
  • Storing Versions
  • Restoring Previous Versions
  • Understanding What Happened

Version Control / Revision control / Source Control is software that helps software developers to work together and maintain a complete history of their work.

Version control is the management system that manages the changes to documents, computer programs, large websites, changes in our projects until the end, and other collections of information. These changes can be anything; it can be the addition of new files, modification of existing files, or deletion of a file.

These changes are usually termed Versions.

We can think of a version control system (“VCS”) as a kind of “database“.

It allows us to save a snapshot of our complete project at any point in time we want. When we later take a look at an older snapshot (“version”), our VCS shows us exactly how it differed from the previous one.

A version control system records the changes we make to our project’s files.

This is what version control is about. It’s really as simple as it sounds.

  • Git
  • Concurrent Versions System (CVS)
  • Subversion
  • Mercurial
  • Team Foundation Server (TFS)

Types of VCS

  • Centralized version control system (CVCS)
    • Ex: CVS, SVN, TFS
  • Distributed version control system (DVCS)
    • Ex: Git, Mercurial

Centralized Version Control System (CVCS)

Uses a central server to store all files, entire project source code and enables team collaboration means allowing a team member to work altogether.

But the major disadvantage of CVCS is its single point of failure, i.e., if the central server fails. Unfortunately, if the central server goes down for an hour, then during that hour, no one can collaborate/work together at all.

Distributed Version Control System (DVCS)

DVCS does not rely on the central server and that is why we can perform many operations when we are offline. We can commit changes, create branches, view logs, and perform other operations when we are offline. We require a network connection only to publish our changes and take the latest changes.

How the Typical VCS works

A typical VCS uses something called Two tree architecture; this is what a lot of other VCS use excluding Git.

Usually, a VCS works by having two places to store things(project code or files):

  1. Working Copy
  2. Repository

These are our two trees; we name them trees because they represent a file structure.

Working copy [CLIENT] is the place where we make our changes.

Whenever we edit something in a file, it is saved in a working copy and is physically stored on a disk(local computer system).

Repository [SERVER] is the place, a directory or storage space where all the version of the files or commits, logs, etc. is stored. It is also saved on a disk and has its own set of files. It can be local to a folder on our computer system or it can be a storage space on GitHub.

We cannot however change or get the files in a repository directly, in able to retrieve a specific file from there, we have to checkout

Checking-out is the process of getting files from the repository to our working copy. This is because we can only edit files when it is on our working copy. When we are done editing the file, we will save it back to the repository by committing it, so that it can be used by other developers.

Committing is the process of putting back the files from working copy to the repository. That means merging the final changes made into a working copy to the repository.

Hence, this architecture is called 2 Tree Architecture.

Because you have two trees in there Working Copy and Repository.

The popular VCS with this kind of architecture is Subversion, SVN, or TFS.

How the Distributed DVCS works

Unusually, a DVCS works by having three places to store things(project code or files):

  1. Working Copy
  2. Staging
  3. Repository

As Git uses a Distributed version control system, let’s speak about Git which will give us an understanding of DVCS.

Git was initially designed and developed by Linus Torvalds for Linux kernel development in the year of 2005. Git is an Open-Source tool.

History

For developing and maintaining Linux Kernel, Linus Torvalds used BitKeeper which is also one of the VCS and is an open-source licensed tool till 2004.

So instead of relying on other tools, they developed their own VCS. For more information about the development of Git, just check the Wikipedia of Git.

What is Git

Git is a distributed revision control system. Git was initially designed and developed by Linus Torvalds for Linux kernel development in the year of 2005. With Git, almost all operations are mainly performed locally, it gives a flawless speed that has constant communication with a server/ repository which is an advantage of centralizing the system. The primary goal of git is to provide better speed and performance and it can handle a large number of repositories.

Git Architecture

Git uses three tree architecture.

Well interestingly Git has the Working Copy and Repository as well but it has added an extra tree name Staging in between:

As we can see above, there is a new tree called Staging. What is this for?

This is one of the fundamental differences of Git that sets it different from other VCS, this Staging tree (usually termed as a Staging area) is a place where we prepare all the things that we are going to commit.

In Git, we don’t move things directly from our working copy to the repository, we have to stage the first, one of the main benefits of this is, to break up our working changes into smaller, self-contained pieces.

To stage a file means to prepare it for a commit.

Staging allows us finer control over exactly how we want to approach version control.

Advantages of Git

  • Team Collaboration
  • Defect Tracking
  • Fast compared to other VCS
  • No single point of failure
  • Sleek, Reliable and Secure
  • Open-Source Cross-platform

Git works on most OS: Linux, Windows, Solaris, and MAC.

Features of Git

  • It’s a free distributed version control system.
  • It provides good speed and fast performance
  • Every Git working directory is a full-fledged repository with completed history of files
  • It allows distributed development of code. Every developer has a local copy of the entire project development history and changes are copied from one repository to another
  • It allows multiple users to work together
  • Large projects can be handled efficiently
  • It is Reliable. In any case, if the system crashes, the lost data can be easily recovered from any of the local repositories of the collaborators.
  • It provides better speed. Fetching data from a local repository is much faster than a remote repository.

What is GitHub?

GitHub is an online platform for hosting the code. It supports version controlling, keeping track of changes made by developers, and collaboration.

It is an American company. Development of the GitHub.com platform started on October 19, 2007. The site was launched in April 2008 by Tom Preston-Werner, Chris Wanstrath, P. J. Hyett, and Scott Chacon. which hosts the source code of our project in any of the programming languages and keeps track of the various changes made by a developer. GitHub on the web gives us the backup of what we have done, allowing us to collaborate with others and to publish what we have done to share it with the outside world.

GitHub is an online Git repository hosting service, which provides a web-based graphical interface, that allows us to synchronize our source code/project store locally into the web. We can also use GitHub to browse other people’s repositories and download code or documents hassle-free. GitHub offers its basic services free of charge. It allows us to create a public or private repository, where the public will be available over the internet to the world and private is limited and only viewable by the repository owner.

How To Use GitHub | GitHub Tutorial For Beginners | Edureka

It provides both distributed version control and source code management (SCM) which is the functionality of Git. It also eases collaboration features such as bug tracking, feature requests, task management, and repository hosting for every project. 

Important components of GitHub are:

  • Repositories
  • Branches
  • Commits
  • Pull Requests
  • Git (the version control tool on which GitHub is built on)

Advantages of GitHub

GitHub can be separated as Git and the Hub. GitHub service includes access controls as well as collaboration features like task bug tracking, management, repository hosting, and team management

  • It became easy to contribute to an open-source project via GitHub.
  • GitHub is a Git repository hosting service, which provides a web-based graphical visual interface.
  • It allows synchronizing our source code/project store locally into the web.
  • It helps to browse other people’s repositories and download code or documents.
  • We can keep track of the various changes in our code across versions.
  • GitHub helps every team member to work together on the project from anywhere and makes it easy for them to collaborate.

Features of GitHub

  • Entire Linux code runs on GITHUB
  • Easy Project management

GitHub is one place where project managers and developers coordinate and work together, track, and update their work so projects stay clear and on time.

  • Effective Team Management

GitHub helps all the team members of the project to stay on the same page and stay well organized. Moderation tools like issue tracker and pull request help them to stay focus on the code.

  • Improved code writing

Pull requests help the project team to review, improve and propose new code on GitHub. The implementation and new code proposals can be discussed before changing the project source code.

  • Easy Code hosting

All the codes and documentation are present in one place. There are tons of repositories on GitHub and each repository has its own tools to help us host and release code.

  • Allows for code collaboration with anyone online
  • Bug tracking
  • Repository hosting
  • Create Public or Private repository
  • Graphical visual interface of branches

Important Concept for GitHub User

  1. Creating a repository

Creating a project repository for multiple people to work together.

  1. Master in a repository

Master in a repository is the final version that is considered ready to use by anyone in the team or outside users if the repository is public.

  1. Creating a branch
  • Create a branch in the project repository, for an environment base where we can try out new logic or ideas.
  • Changes we make on a branch don’t affect the master unless a pull request is accepted for the same.
  • Changes committed to branches reflect for us to keep track of different versions.
  1. Adding commits
  • It keeps track of our progress as we work on branch or master.
  • It creates a transparent history of commits with a description that others can follow to understand what we have done and why.
  1. Forking  a repository 
  • It creates a copy for us to work on independently without making any changes to theirs.
  • Submit a pull request to the owner so that the owner can incorporate/merge the changes.
  1. Pull requests
  • Pull requests initiate discussion about our commits or changes made to a code.
  • See exactly what changes would be merged if the pull request is accepted.
  • Use GitHub’s @ mention system in the pull request message to ask for feedback from specific people or teams, or for someone to review our work.
  1. Issues
  • Highlights bugs or issues with codes that need rectification/correction.
  • Issues remain open unless resolved.
  • It can be filtered, can be labeled as bug/enhancement/question/ help wanted, etc.
  • @mention can be used to notify someone/concerned person.
  1. Markdown syntax
  • Markdown is a way to style text on the web.
  • Available in descriptions and comments of issues and pull requests. These include @mentions as well as references to SHA-1 hashes, issues, and pull requests.
  1. Watch and star

Watch notifies us of all conversations over and above our @mentions, commits, comments on the discussion. Star will favorite it but not show on our dashboards like a watch.

  1. Cloning repository
  • Cloning is for making a local copy from a remote copy in GitHub and working on a project. GitHub is a remote repository.
  • Entire projects can be copied locally and work on it without internet access.
  • Multiple people can work on GitHub
  • When we push our changes to GitHub, other users can pull the request and see them

Understanding GitHub Workflow

  • Branching:

Create a branch on the master replica, as the changes should not be done on the master. Master should always have to be deployable. 

A branch is an exact copy of the master

  • Commits

Sort of making changes to branches

  • Pull request

Open a pull request on GitHub. Comparing the change with the master and showing other people about our changes.

  • Collaboration

The project team member may give suggestion for the new approach/ideas or go-ahead

  • Merge

Whatever changes have been made to the code that needs to be committed to the branch

Git Vs GitHub Comparison

GitGitHub
Installed locally on the systemHosted in the cloud
First released in 2005Company launched in 2008
Maintained by the Linux foundationPurchased by Microsoft in 2018
It’s a command-line toolIt’s a Git repository hosting service. It is managed through the web
Git can be used offline and does not need an internet connection for useGitHub cannot be used offline and needs an internet connection
Git can be used without GitHub GitHub cannot be used without Git
Used for version control and code sharing Used for centralized source code hosting
It provides a desktop interface called Git GUIIt provides a desktop interface called GitHub desktop GUI
Code changes like commit, merge, etc. are done using commands from the command lineEverything is done through a web-based interface
Open-source licensedIncludes a free tier and pay-for-use tiers
Focused on version control and code sharing Focused on centralized source code hosting
It doesn’t have a user management featureIt has a built-in user management feature
It has a minimal external tool configuration feature.It has an active marketplace for tool configuration
Competitors – Mercurial, Supervision, Competitors Bitbucket and GitLab

GitLab vs. GitHub

GitHubGitLab
It was launched in the year 2008. It is a Git repository hosting service.It was launched in the year 2011 as an alternative to the available Git repository hosting service.
It is a web-based hosting service for version control using Git.A web-based DevOps lifecycle tool that provides a Git repository manager. It has everything GitHub has, but with extra features and increased control over the repositories
It is most popular than GitLabIt is less popular than GitHub
It is free for public and private repositories.It is free for both private and public repositories.
In GitHub, we have a repository for project source code.In GitLab we have a project, it is a container including the Git repository, attachments, project-specific settings, etc.
In GitHub a request to merge a change made into a branch into the official master is called a pull requestIn GitHub a request to merge a change made into a branch into the official master is called a merge request
Provides various third-party integrations for continuous integration and continuous delivery work.Offers its own pre-built continuous integration and continuous delivery support.
It offers an easy-to-use intuitive UI for project management.It offers a more convenient UI allowing users to access everything from one screen.
It is closed source means it is not open-source but can host open-source projects.The GitLab community edition is free and open-sourced.
When GitHub is down, we can commit code locally, but CI/CD doesn’t work.When GitLab is down, we have to fix our server, by freeing more space of whatever it’s consuming.
It contains millions of repositories.It has lesser projects than GitHub.

Bitbucket vs. GitHub

GitHubBitbucket
GitHub is supported by Git only.Bitbucket supports Git and other version control systems like Mercurial.
Purchase by Microsoft.Bitbucket is also a web-based code repository hosting service owned by Atlassian
GitHub is a web-based source code repository hosting platform that allows developers from all over the world to work together on projects.Bitbucket is a cloud-based source code repository hosting service that provides private and public code repositories for advanced collaboration.
It provides free service for public and private repositories.It provides free service for both private and public repositories. But we can have a maximum of five members for a private repository.
GitHub doesn’t offer a sematic search feature for things like classes, interface, etc.Bitbucket offers semantic search features which save time.
Trello can be accessed through GitHub via Power-UpsIt allows teams to track their work and keep other members up to date with Trello boards.

How to use GitHub?

Below are the steps that guide us through how we can GitHub and create a repository and so on.

Step1: Signup for GitHub 

Step2: Create a repository

Step3: Install and setup Git

Step4: Clone the remote repository

Step5: Make changes to files

Step6: Add changes to the staging area

Step7: Commit changes

Step8: Push changes to remote

Avatar photo
Great Learning Team
Great Learning's Blog covers the latest developments and innovations in technology that can be leveraged to build rewarding careers. You'll find career guides, tech tutorials and industry news to keep yourself updated with the fast-changing world of tech and business.

Leave a Comment

Your email address will not be published. Required fields are marked *

Great Learning Free Online Courses
Scroll to Top