What is Git?
• Source Code Management (SCM) Tool.
• Version Control System (VCS) Tool.
• Keeps Track Of Changes.
• Versions Can Be Shared Between Multiple Users.
• Open Source.
How Git Works?
• Takes Snapshot Of The Changes Done.
• Each Change Updated Is Stored As Snapshot.
• Can Retrieve The Snapshot Created Previously.
• Multiple Persons Can Work And Update Files In
The Same Repository At The Same Time.
Key Terms Before Installation
• Branch Header
• Branch Merging
• Push and Pull
How To Install And Configure Git
• Go To http://git-scm.com/download For
Command Based Git.
• Go To http://git-scm.com/downloads/guis for
GUI Based Git Control.
• After installation, Set The PATH Environment
variable to C:Program Files (x86)Gitbin
Create Repository On Git
• Go to https://github.com/ and Signup
• A Repository is a virtual name which keeps your
project and changes made to the files. Create a
new Repository by clicking on “New repository”
button on the home page after signup up or
• Check the option ” Initialize this repository with
• The default branch name for the Repository is
• Create a directory with name “gittest”. You can
use DOS command ‘md gittest’.
• To move into the directory give command ‘cd
• To create a git repository on the local
server(your machine) type the command
‘git init .’ This creates a new subdirectory
named .git that contains all of your necessary
repository files — a Git repository skeleton.
• Now get the existing project name from
github.com into your local server repository. The
command is ‘git clone --recursive
email@example.com:riteshtandon23/gittest’ (i.e. The
• Recursive is used so that any changes made to
the branches are also added in the current local
repository. Use ‘git pull’ to get all files.
• Incase facing error of unauthorized access or
permission denied you need to generate a new
pass key ‘ssh-keygen -t rsa -C
• Now add some files inside your new directory
created under the folder ‘gittest’.
• This command would create a snapshot of the
current directory structure and files. Command
‘git add .’
• This commands tells that the snapshot is ready
to be committed from local to remote origin.
Command ‘git commit -m "First commit”’
• Give command ‘git push origin master’. This
would push the snapshot to the remote origin.
• A branch is created when we want to change
some code from a stabilized version.
• To create a branch, The command is ‘git branch
• Also create the same branch on Github website.
• To list all branches, The command is ‘git branch’.
• Now, Create a branch on Github.com interface.
with the name ‘ritesh’.
• Now, Create a new folder in the main directory
with name of the branch, this would actually
map with the branch created on the origin.The
command is ‘md ritesh’.
• Now move into the directory having the branch
name. i.e. ‘cd ritesh’ ’. and give the command
‘git clone -b ritesh --recursive
• Now add some files into the local directory.
• To create a snapshot the command is ‘git add .’
• To prepare for commit give command ‘git
commit –am “Branch Commit”’
• To push the updated snapshot, Give the
command ‘git push origin ritesh’
• Now move into the folder inside the branch
folder(ritesh), This can be done by ‘cd
Moving On To The Previous Versions
• To move on to the previous versions, We need
to check the previous commits done by the user.
• You can find this on the “Commits” link on the
home page of the Github page.
• On the Commits page there is list of commits
the user has done in the past. To move on to the
previous version copy the SSH code on the right
side of the commit.
• Give the command ‘git reset --hard SSHCode’
• Give comamnd ‘git pull’ to update local folder.