0% found this document useful (0 votes)
23 views22 pages

Scmfile

Uploaded by

Vikas Panchal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views22 pages

Scmfile

Uploaded by

Vikas Panchal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Subject Name: Source Code Management

Subject Code: CS181

Cluster: Zeta

Department: DCSE

Submitted by: Submitted to:


Vikas Dr. Mukund Pratap Singh
2110992493
G31
INDEX
S. NO Experiment Name Page No.

1. Introduction 3-5

2. Setting up of Git Client 6-10

3. Setting up GitHub Account 11-12

4. Program to Generate logs 13-15

5. Create and visualize branches 16-19

6. Git lifecycle description 20-21


Introduction

What is GIT and why is it used?

Git is a source code management technology used by DevOps. Git is a piece


of software that allows you to track changes in any group of files. It is a free
and open-source version control system that may be used to efficiently
manage small to big projects.
Git is a version control system that allows numerous developers to
collaborate on non-linear development projects.
Git is an example of a distributed version control system (DVCS) (hence
Distributed Version Control System).

What is GITHUB?

GitHub is a version management and collaboration tool for programming. It


allows you and others to collaborate on projects from any location.

What is the difference between GIT and


GITHUB?
What is Repository?

A repository stores all of your project's files, as well as the revision history
for each one. Within the repository, you may discuss and monitor your
project's progress. The .git/ subdirectory within a project is a Git
repository. This repository keeps track of any changes made to files in your
project over time, creating a history. That is, if you delete the.git/
subdirectory, you are also deleting the history of your project.

What is Version Control System (VCS)?

Version Control Systems are the software tools for tracking/managing all
the changes made to the source code during the project development. It
keeps a record of every single change made to the code. It also allows us to
turn back to the previous version of the code if any mistake is made in the
current version. Without a VCS in place, it would not be possible to monitor
the development of the project.
Types of VCS

 Local Version Control System


 Centralized Version Control System
 Distributed Version Control System

I. Local Version Control System: Local Version Control System is located


in your local machine. If the local machine crashes, it would not be
possible to retrieve the files, and all the information will be lost. If
anything happens to a single version, all the versions made after that
will be lost.
II. Centralized Version Control System: In the Centralized Version
Control Systems, there will be a single central server that contains all
the files related to the project, and many collaborators checkout files
from this single server (you will only have a working copy). The
problem with the Centralized Version Control Systems is if the central
server crashes, almost everything related to the project will be lost.

III. Distributed Version Control System: In a distributed version control


system, there will be one or more servers and many collaborators
similar to the centralized system. But the difference is, not only do they
check out the latest version, but each collaborator will have an exact
copy of the main repository on their local machines. Each user has their
own repository and a working copy. This is very useful because even if
the server crashes we would not lose everything as several copies are
residing in several other computers.
Experiment No. 01

Aim: Setting up of Git Client

 For git installation on your


system, go to the linked URL.
https://git-
scm.com/downloads

 You must first access this webpage and then choose your operating
System by clicking on it. I will walk you through the processes for the 
Windows operating system in this article.
 Select the CPU for your system now. (Most of the system now runs on
64-bit processors.) Your download will begin when you pick a
processor.

 You must now open the Git folder.

 You will be asked if you want to enable this program to make


modifications to your PC once you launch it.

 YES, should be selected.


 Click on Next
 Continue clicking on next few times more

 Now select the Install option.


 Click on Finish after the installation is finished.

The installation of the git is finished and now we have to setup


git client and GitHub account.
Experiment No. 02

Aim: Setting up GitHub Account

 Open your web browser search GitHub login.

 Click on Create an account if you are a new user or if you have


already an account, please login.
 After clicking on "Create a New Account," you will be sent to a new page
where you must enter your email address for your account. Now type in
the password you'd want to use for your GitHub account. Then you'll be
prompted to enter your username.

 Now Click on Create Account.

 Verify it from your email and you are all set to go.
Experiment No. 03

Aim: Program to Generate logs

 First of all, create a local repository using Git. For this, you have to make a
folder in your device, right click and select “Git Bash Here”. This opens the
Git terminal. To create a new local repository, use the command “git init”
and it creates a folder. git.

 When we use GIT for the first time, we have to give the user name and
email so that if I am going to change in project, it will be visible to all.
For this, we use command 
“git config --global user.name Name”
“git config --global user. email email”

For verifying the user’s name and email, we use 


“git config --global user.name”
“git config --global user.email”

Some Important Commands:


 ls  It gives the file names in the folder.
 ls -lart  Gives the hidden files also.
 git status  Displays the state of the working directory and the
staged snapshot.
 touch filename  This command creates a new file in the
repository.
 Clear  It clears the terminal.
 rm -rf .git  It removes the repository.
 git log  displays all of the commits in a repository's history
 git diff  It compares my working tree to staging area.
Now, we have to create some files in the repository. Suppose we
created instructions.txt Now type git status:

You can see that instructions.txt is in red colour that means it is an


untracked file.
Now firstly add the file in staging area and then commit the file.
For this, use command 
git add -A [ For add all the files in staging area.]
git commit -m “write any message” [ For commit the file]
 git log: The git log command displays a record of the commits in a
Git repository. By default, the git log command displays a commit
hash, the commit message, and other commit metadata. 
Experiment No. 04

Aim: Create and visualize branches

 Branching: A branch in Git is an independent line of work (a pointer


to a specific commit). It allows users to create a branch from the
original code (master branch) and isolate their work. Branches
allow you to work on different parts of a project without impacting
the main branch.

Let us see the command of it:


Firstly, add a new branch, let us suppose the branch name is activity1.
For this use command 
 git branch name [adding new branch]
 git branch [use to see the branch’s names]
 git checkout branch name [use to switch to the given branch]
In this you can see that firstly ‘git branch’ shows only one branch in
green colour but when we add a new branch using ‘git branch admin’,
it shows 2 branches but the green colour and star is on master. So, we
have to switch to admin by using ‘git checkout admin’. If we use ‘git
branch’, now you can see that the green colour and star is on admin.
It means you are in admin branch and all the data of master branch is
also on admin branch. Use “ls” to see the files.

Now add a new file in admin branch, do some changes in file and
commit the file.
If we switched to master branch, ‘nothing.txt’ file is not there. But the
file is in admin branch.

 To add these files in master branch, we have to do merging. For


this firstly switch to master branch and then use command 
git merge branch-name [use to merge branch]
Experiment No. 05
Aim: Git lifecycle description

Stages in GIT Life Cycle:


Now let’s understand the three-stage architecture of Git:

 Working Directory: This is the directory that we’ve initialized, and


here all the changes are made to commit on GitHub.

 Staging Area: This is where we first put out code or files of the
working repository. The command that we use to stage code is,
“git add --a”, “git add File-Name” or “git add -A”. In simple terms,
staging means telling Git what files we want to commit (new
untracked files, modified files, or deleted files).
 Git directory(repository): This is where all the commits are stored
whenever we make a commit. We can revert to an older version
of or project using the “git checkout” command from this
directory.

You might also like