Devops Assignment 1

You might also like

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

DevOps Assignment 1 [2022-2023 SEM 2]

Name : Selvabharathi S
ID NO : 2022mt93556
Course Code : SEZG514
Course Name: Introduction to DevOps

 Created a GitHub account (GitHub) , using bits email ID.


Installed git in my PC.
 I am using VS CODE screen shot to show the
visualization output.
==================================================
=============================
Step 1) Create a New Repository
==================================================
=============================
 In terminal type “git init”. git init command will
initializes .git repository inside devops Assignment
directory. This .git will be hidden, and never delete this
after creation.
==================================================
==============================
Step 2) Add Two Directory and some raw code files to the
repository
==================================================
==============================
 Created two directory “test one” & “test two” with
some raw java script file into it respectively “test one.js”
& “test two.js”
Have to link our local git repository to centralised github, for
that, lets first create a centralised repo in github, and copy its
.git url.
Now use “git remote add origin” command to link your local
repo to centralised repository.
 Use “git status” to see the files to add to tracking and
modified files etc.
 Now we have two files and two directory newly added,
and its still in untracked. Lets add it. On adding all new
files, .git folder keeps track of it like a ledger. So what
ever we add, remove, delete, everything will be kept
track.
 I am using “git add .” which add all the files, if we want
to add any particular file we can specify the file name,
or if any particular extension, we can mention extension
alone.
You can see on adding the file for tracking, they are now in
staged changes, we can commit our change only when files
are in staged stage.

==================================================
============================
Step 3) Move Code from One directory to Another Directory
==================================================
============================
 You can see I have moved “test two.js” from “test two”
folder to “test one” folder, by just using cut, paste of
windows command.
 As a result, my git kept monitoring behind, and when I
do git status, it tells me one file is deleted from “test
two” folder and one new file got added to “test one”
folder.
 On moving this again become to “untracked” status, so
we need to add it to git so that this new file can be
tracked.
 Using command “git add test one/test two.js (few
people may face git command err, if you have space
between your folder name)
==================================================
============================
Step 4) Update one source code file and display the
difference
==================================================
============================

 So far our java script file doesn’t have any code to see
the difference, so lets add some code first and move
that code to stage status, so that on adding new code,
we can see the difference.
We got some code in “test one.js” lets modify this if
condition and see the diff, there are 2 ways to see diff one is
the IDE u are using, the another is via, traditional git
command, we will explore both.
 I have used “git diff” command to see the diff in
traditional way.
 Now lets see how IDE helps in seeing the diff.
 IDE usually very help full, in visualization these kind of
diff, in production we have lot of diff to be checked, so
cmd like wont he helpful at that moment.

==================================================
=============================
Step 5) Create a Branch
==================================================
=============================
 Use “git checkout –b branchName” command to create
a new branch from the current branch. There may be
other command too for creating a branch, and lot of diff
way to create it from IDE too. You can use whatever is
apt to your connivance.
 We care currently in master branch, so on executing this
command, a new branch will be created from master.
 Its advised to get the latest code on the branch from
which you are going to create another branch.
==============================================
===============================
Step 6) Add some raw code to the branch
==============================================
===============================
In new branch, I have modified one file, and created two
new files. Lets stage all of them and publish the new
branch. Have to do same process, “git add .” “git commit
commitMessage”. “git push origin –u side-work”

==============================================
===============================
Step 7) Merge the Branch with Main line
==============================================
===============================

 When ever trying to merge, get the latest code of the


both branch, the branch where u merge, and the branch
from you merge.
 Use “git branch merge branchName” command to
merge given branchName to current branch.
 I checked out from side-branch by using “git checkout
main”
 Finally “git push”

 It’s a public repo only, you can visit using this URL:
Selvabharathi-wilp-bits-pilani/bits-wilp-devops (github.com)

==================================================
==========================
And at the end provide the Summary of advantages of
moving from Centralized Source Code to Distributed Version
Control.
==================================================
=========================
1. Maintain multiple copies of repository which will avoid single point of failure in case of centralized
version control software -- Reliable backup copies

2. Fast merging and flexible branching

3. Multiple developers can work faster

4. Rapid feedback and fewer merge conflicts

5. Flexibility to developers to work offline

6. One of the biggest advantages of Git is its branching capabilities. Git branches are cheap and easy
to merge.

7. Keep history and track changes.

You might also like