Name: Sonam Gupta Roll No.: 201903015 (14) Subject: Devops Lab

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Name: Sonam Gupta

Roll No. : 201903015 (14)


Subject: DevOps Lab
Experiment No. 3

Aim: To Perform various GIT operations on local and Remote repositories


using GIT Cheat-Sheet.
Theory:
Local Repository:
Git is a distributed version control system and it makes Git awesome. Your
local repository has exactly the same features and functionality as any other Git
repository. So a Git repo on a server is the same as a Git repo on GitHub
(granted GitHub adds additional features, but at its core, you're dealing with Git
repositories) which is the same as your co-worker's local repo.
So why is that awesome? Because there is no central repo you have to have
access to do your work. You can commit, branch, and party on your own repo
on your local machine even without internet access. Then, when you have a
connection again, you can push your changes to any other Git repo you have
access to. So while most people treat a particular repo as the central repo
(repository), that's a process choice, not a Git requirement.
The point of all that was to state (as others have) that you're committing your
README to your local repo. Then, whenever you choose, you can push
changes from your local repo to any other repo. It's pretty nifty!

Global Repository:
The global repository is the hub of the repository domain. Use the global
repository to store common objects that multiple developers can use through
shortcuts. These objects may include operational or application source
definitions, reusable transformations, mapplets, and mappings.

What is Git ?
Git is a distributed version control framework that is free and open source.
Linus Torvalds, the developer of the Linux operating system kernel, created it in
2005.
Git is used for project collaboration and history exploration. Git provides all of
the benefits of a distributed Version Control system.

Features of git:
Fully Distributed VCS
Every participating node in distributed VCS has a complete copy of the project
as well as a full revision history of each file. This allows you to work locally
without a network connection all while allowing you to collaborate when you
are back online via central remote repositories. Being distributed git implicitly
provides you the advantage of having multiple backups and choice to follow
workflow of your choice locally.

Data Integrity And Security


Git uses cryptographic algorithms to store files and snapshots. The checksum is
determined when the files are stored and checked when they are retrieved. If
you change things to a file, date, author information, commit message, or
something else, the associated commit id changes. Use of the same commit ID
ensures that your project is exactly the same as when it was committed, and that
the history has not been altered.

Supports Non-linear Development


Git supports frictionless and rapid context switching between different linear
workflows. This allows developers to work asynchronously and managers to do,
frequent releases which generates frequent customer feedback and faster
updates in reaction to that feedback.

Branching
This is a very powerful feature that allows for parallel creation and simple
merges. Any new feature can be tested and worked on around the branches, and
then integrated with the production branch almost instantly without affecting
other people's code. Working with git offers an isolated environment for any
change to your codebase made by any team member due to branch magic. This
contributes to the adoption of feature-based workflow and also gives us the
ability to perform experimentation that can be quickly discarded.

Lightweight And Fast- Everything Is Local


Almost all git operations are done locally, which greatly decreases network
calls. Furthermore, the source code of git is written in C, a low-level language,
which reduces overall runtime. Since git stores all project files with their full
revision history, the repository's overall size can balloon significantly. Git
optimises for this by combining the files into a Packfile. The Pack File stores
the files and the variations in each version of the file.

Open-source and free


Git is heavily used by the developers as it is free and open to the community.
Commands:
Initailizing a git repository using “git init” command:

Figure 1

Making dummy text document in that initialized repo folder

Figure 2
Checking git status by using “git status” command:

Figure 3

Running command “git config –global user.username Sonam-1112”:

Figure 4
Taking remote access to that new created repo using “git remote add origin
repo_link” and Pushing files to repo using command “git push origin master”:

Figure 5

Finally all changes made in directory pushed into repo as given below:

Figure 6
Checking history operations that are done using “git log” command:

Figure 7

Getting history info also using “git log --oneline” command:

Figure 8
Getting history info of particular file created using “git log file_name”:

Figure 9

Editing created file using “vim file_name” command and after editing, checking
git status using “git status” command:

Figure 10
Checking difference between pushed file on github and edited file using ”git
diff file_name” command:

Figure 11

Conclusion: By doing this experiment I get to know more about git commands
git log which is used to check history related to some repository and it can also
be used to check history status of specific file or folder by specifying name of it
after git log then vim command which can edit file at that moment and many
more.

You might also like