GitHub - SPLessons

GitHub Tutorials

Chapter 1

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

GitHub Tutorials

GitHub Tutorials

shape Introduction

In this article, one can learn about GitHub and following are the topics covered.
  • What is Git?
  • History of Git
  • Basic Git Commands

What is Git?

shape Description

Git is a version control system or source control system which track the changes and allow to commit the changes to a source control repositories. These systems are developed to facilitate collaboration among a group of developers working in the same code base. Git is different from other version control systems and is a modern Distributed version control system. There are most advantageous scenarios in Git as a distributed system. Git mainly focuses on
  • Branching and merging
  • Committing
  • pulling and pushing

In an open source community, version control system should be very fast and Git has been proved very fast and scalable. As software project scales from small to large projects with number of developers involved in. So, system need to be distributed and parallelized.

History of Git

shape Description

Git was created by “Linus Torvalds”, who is also the creator of “Linux”. Git creation was prompted by “Linux-Bitkeeper” separation where Bitkeeper was a commercial DVCS that was used by Linux kernel team from 2002-2005 when Bitkeeper decided to stop supplying the Linux kernel team with free licenses to use Bitkeeper.

At this moment, Linux kernel need a new Distributed version control system to replace the old one. Then Linux decided to started a project “Git” in 2005 to create their own DVCS. Which was written in “Perl” and “C”, Git runs on Linux, Mac OS X and Windows many other wide range operating systems. The main design goals of Git are

  • Speed
  • Simplicity
  • Strong branching/merge support
  • Distributed
  • Scales well for large projects

Git was designed to use on Linux kernel which was very large piece of software. Since 2005 Git was growing, changing and increasing its popularity.


shape Introduction

Centralized version control system (CVC)

shape Description

In centralized version control, each developer works on own computer and makes commits to a central server that is managing all of the code in which case each developer receives updates from the server and sends update directly to the server.

In a simple way, CVC is a central copy of the project somewhere on a server. When developers commit the changes to this central copy and other developers can see and pull down the change and the changed content of any file will be automatically updated by the version control tool. Now-a-days, the modern control system deal with “changesets”. When a group of changes done to many files the term is defined as “changesets“, which is treated as a cohesive whole.

In CVC, developers need not maintain many files manually in the drives, because developer can retrieve the version they need from central copy which is done by version control tool.

shape Conceptual

Distributed version control system (DVC)

shape Description

In Distributed version control system, developers have own personal source control repositories. The personal source control repositories means the commits made by developer are local. Each time the developer commit, the new version of the code is stored in the local repository which makes the developer easy to commit frequently and have less impact on other developers

Once developer satisfied with the code and ready for others to consume can push those changes out for other people to access. Getting new changes from a repository is called Pulling. Moving the new changes to a repository is called Pushing. The common point in both the cases was moving the new changes to a repository.

shape Conceptual

Basic Git commands

shape Commands

As Git was created like command line tool the following are the basic Git commands.
Task Notes Commands
Create a new local repository init command used for creating a new local repository git init
To check Status Used to know the current state of local repository git status
Add files Used to add files to the repository git add filename
commit files used to save the current working directory of the repository git commit
Log Log is used to see the changes that have been committed git log
Push Used to push the changes committed locally
up to the central repository
git push
Pull Used to pull the changes down from another repository git pull
merge Merge is the command used for merge changes that have commit
from separate places or separate branches or two pieces of code
that need to be merge together
git merge


shape Points

  • Git is a version control system.
  • Commits in Git happen locally
  • Git makes branching and merging easier