FSD Unit I
FSD Unit I
Unit-I
HTML COMMON TAGS
What is an HTML File?
<html>
<head>
<title>Title of page</title>
</head>
<body>
Hello World! This is my first homepage. <b>This text is bold</b>
</body>
</html>
Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your
browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file
you just created - "mypage.html" - select it and click "Open". Now you should see an address in
the dialog box, for example "C:\MyDocuments\webdesign\mypage.html". Click OK, and the
browser will display the page.
Example Explained
The first tag in your HTML document is <html>. This tag tells your browser that this is
the start of an HTML document. The last tag in your document is </html>. This tag tells your
browser that this is the end of the HTML document.
The text between the <head> tag and the </head> tag is header information. Header
information is not displayed in the browser window. The text between the <title> tags is the title
of your document. The title is displayed in your browser's caption. The text between the <body>
tags is the text that will be displayed in your browser. The text between the <b> and </b> tags
will be displayed in a bold font.
CSE -1-
Full Stack Development Unit-I
HTML ELEMENTS
HTML documents are text files made up of HTML elements. HTML elements are
defined using HTML tags.
HTML Tags
The purpose of the <b> tag is to define an HTML element that should be displayed as bold.
Tag Attributes
Tags can have attributes. Attributes can provide additional information about the HTML
elements on your page.
This tag defines the body element of your HTML page: <body>. With an added bgcolor
attribute, you can tell the browser that the background color of your page should be red, like this:
<body bgcolor="red">
This tag defines an HTML table: <table>. With an added border attribute, you can tell the
browser that the table should have no borders: <table border="0">. Attributes always come in
name/value pairs like this: name="value". Attributes are always added to the start tag of an
HTML element.
1. HEADINGS
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading. <h6>
defines the smallest heading.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>
CSE -2-
Full Stack Development Unit-I
HTML automatically adds an extra blank line before and after a heading.
2. PARAGRAPHS
<p>This is a paragraph</p>
<p>This is another paragraph</p>
HTML automatically adds an extra blank line before and after a paragraph.
3. LINE BREAKS
The <br> tag is used when you want to end a line, but don't want to start a new paragraph. The
<br> tag forces a line break wherever you place it.
4. Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment will be
ignored by the browser. You can use comments to explain your code, which can help you when
you edit the source code at a later date.
Note that you need an exclamation point after the opening bracket, but not before the closing
bracket.
CSE -3-
Full Stack Development Unit-I
Example
Source Output
<i>Italic text</i><br /> Italic text
<b>Bold text</b><br /> Bold text
<em>Emphasized text</em><br> Emphasized text
<strong>Strong text</strong><br> Strong text
What is the difference between <i> & <em> and <b> & <strong>, <b> and <i> will both
become deprecated tags. Using <strong> and <em> are the tags that will be cross-browser
compatible as browsers move forward to embrace the new standards in HTML (e.g., XHTML)
2. HTML Links
HTML uses a hyperlink to link to another document on the Web. HTML uses the <a>
(anchor) tag to create a link to another document. An anchor can point to any resource on the
Web: an HTML page, an image, a sound file, a movie, etc.
The <a> tag is used to create an anchor to link from, the href attribute is used to address the
document to link to, and the words between the open and close of the anchor tag will be
displayed as a hyperlink.
<a href="http://www.google.co.in/">Google</a>
CSE -4-
Full Stack Development Unit-I
<a name="label">Text to be displayed</a>
The name attribute is used to create a named anchor. The name of the anchor can be any text you
care to use.
The line below defines a named anchor:
<a name="tips">Useful Tips Section</a>
You should notice that a named anchor is not displayed in a special way. To link directly to the
"tips" section, add a # sign and the name of the anchor to the end of a URL, like this:
<a href="http://www.amyschan.com/mypage.html#tips">
Jump to the Useful Tips Section</a>
HTML LISTS
HTML supports ordered, unordered and definition lists.
1. Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically small
black circles).
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
Here is how it looks in a browser:
Coffee
Milk
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
2. Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers.
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
Here is how it looks in a browser:
1. Coffee
2. Milk
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
CSE -5-
Full Stack Development Unit-I
HTML TABLE
Tables are defined with the <table> tag.
A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the
<td> tag). td stands for "table data," and holds the content of a data cell. A <td> tag can contain
text, links, images, lists, forms, other tables, etc.
Table Example
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
If you do not specify a border attribute, the table will be displayed without borders. Sometimes
this can be useful, but most of the time, we want the borders to show.
<table border="1">
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table>
CSE -6-
Full Stack Development Unit-I
Header information in a table are defined with the <th> tag. All major browsers display the text
in the <th> element as bold and centered.
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
Header 1 Header 2
CSE -7-
Full Stack Development Unit-I
Example
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
CSE -8-
Full Stack Development Unit-I
HTML IMAGES
With HTML you can display images in a document.
In HTML, images are defined with the <img> tag. To display an image on a page, you
need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of
the image you want to display on your page.
The syntax of defining an image: <img src="url">
The URL points to the location where the image is stored. An image named "boat.gif"
located in the directory "images" on "www.w3schools.com" has the URL:
http://www.w3schools.com/images/boat.gif. The browser puts the image where the image tag
occurs in the document. If you put an image tag between two paragraphs, the browser shows the
first paragraph, then the image, and then the second paragraph.
The alt attribute is used to define an "alternate text" for an image. The value of the alt attribute is
an author-defined text:
HTML BACKGROUNDS
A good background can make a Web site look really great.
Backgrounds
The <body> tag has two attributes where you can specify backgrounds. The background can be a
color or an image.
1. Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute
can be a hexadecimal number, an RGB value, or a color name:
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
CSE -9-
Full Stack Development Unit-I
The lines above all set the background-color to black.
2. Background
The background attribute specifies a background-image for an HTML page. The value of this
attribute is the URL of the image you want to use. If the image is smaller than the browser
window, the image will repeat itself until it fills the entire browser window.
<body background="images/cloudswirl.jpg">
<body background="http://www.amyschan.com/images/cloudswirl.jpg">
FORMS
Forms can be used to collect information. Sophisticated forms may be linked to a
database to store the information, but this is beyond the scope of the article. This article will
show you how to create a form that emails you the information.
Here is a very basic email form:
<form action="mailto:[email protected]" method="post">
Name:<br>
<input type="text" name="name" size="20"><br>
Email:<br>
<input type="text" name="email" size="20"><br>
Comment:<br>
<textarea cols="20" rows="5"></textarea><br>
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</form>
And here's what it looks like:
Name:
Email:
Comment:
Submit Reset
Notice that the "input" tag was used for the text fields as well as the buttons! The "input" tag is
the tag you will use most often in forms. Here are different forms of the input tag:
type="text"
type="password" (asterisks when you type)
type="checkbox"
type="radio"
Submit Query
type="submit" (You can change the text on the button.)
CSE - 10 -
Full Stack Development Unit-I
Reset
type="reset" (You can change the text on the button.)
type="hidden" (You can't see this because it's hidden! This allows you to send additional
variables that your user can't see.)
type="button" (You can change the text on the button.
Below you will find a table of the various form elements and how you can use them.
FORM – attributes
action This attribute usually has a link to a web page that contains code which
="[url]" processes the form. In our example above, we use "mailto" to tell the form to
send the information as an email.
method This attribute specifies how the information is sent. With the "get" method, all
="get" the information is sent in one long URL string. With the "post" method, all the
="post" information is sent but is "invisible" to the user.
name When creating complex forms and using scripting, you may need to specify the
="[name of name of the form. The name should be unique - that is, you shouldn't have other
form]" forms on the page with the same form name.
INPUT – attributes
type The "type" attribute allows you to specify what type of form element you want
="text" to use. As you can see, the "input" element can have many different forms - see
="password" above for examples.
="checkbox"
="radio"
="submit"
="reset"
="hidden"
="button"
checked This attribute does not have any values. When you put this attribute into the tag
for "radio" or "checkbox," they will be selected.
src Use this attribute when you have an "image" to specify the location of the image.
="[url]"
TEXTAREA - attributes
This form element is the multi-line text box that you often seen for "comments." The opening
and closing tag surround the text that will be initially displayed.
name This attribute must be set to a unique name so you know how to refer to the form
="[referring element.
name]"
rows This attribute allows you to set the number of rows for the text area.
="[number]"
cols This attribute allows you to set the number of columns for the text area.
="[number]"
CSE - 11 -
Full Stack Development Unit-I
SELECT - attributes
The SELECT tag allows you to create "select boxes" or "drop down menus." It is the "outer"
element, used with the OPTION tag. (See the example link below)
name This attribute must be set to a unique name so you know how to refer to the form
="[referring element.
name]"
size This attribute allows you to set how many rows are visible.
="[number]"
multiple This attribute does not have any "values." When you set this attribute, it allows
the user to select more than one option.
OPTION - attributes
The OPTION tag is used with the SELECT tag to define the different options in the select
box or dropdown menu. The opening and closing tag surround the text that will be displayed.
value This attribute must be set to a unique name so you know how to refer to the form
="[value]" element. It will probably be an abbreviated version of the text that is displayed.
selected This attribute does not have any "values." When you set this attribute, it marks
this option as being "preselected."
Putting it all together...
Here's a sample page using this code below:
<form>
Enter your Name: <input type="text" width="20" size="20">
<p>Favorite Color:<br>
<input type="checkbox" checked value="red" name="colors"> Red<br>
<input type="checkbox" value="blue" name="colors"> Blue</p>
<p>Gender:<br>
<input type="radio" checked value="male" name="gender">Male<br>
<input type="radio" value="female" name="gender">Female</p>
<p>Address:<br>
<textarea rows="5" cols="20">Please enter your permanent address
here.</textarea></p>
Country:<br>
<select name="country">
<option value="usa" selected>USA</option>
<option value="uk">United Kingdom</option>
<option value="canada">Canada</option>
</select>
CSE - 12 -
Full Stack Development Unit-I
CSS
Introduction to CSS:
CSS stands for Cascading Style Sheets. CSS describes how HTML elements are to be
displayed on screen, paper, or in other media. CSS saves a lot of work. It can control the layout
of multiple web pages all at once. External style sheets are stored in “.css” files. CSS is used to
define styles for your web pages, including the design, layout and variations in display for
different devices and screen sizes.
Types of CSS:
There are three types of CSS available. They are:
1) Inline CSS
2) Internal CSS
3) External CSS
1. Inline CSS:
If the styles are mentioned along with the tag then this type of CSS is known as inline CSS.
Example:
<p style=”text-align: justify; background-color: red”>Hi this is the Inline CSS. </p>
2. Internal CSS:
For internal CSS, we write all the desired “styles” for the “selectors” along with the
properties and values in the “head” section. And in the body section then newly defied
selector tags are used with the actual contents.
Example:
<html>
<head>
<style type= “text/css”>
p
{
text-align: justify;
background-color: red;
}
</style>
</head>
<body>
<p>This is Internal CSS.</p>
</body>
</html>
3. External CSS:
Sometimes we need to apply particular style to more than one web page; in such cases
external CSS can be used. The main idea in this type of CSS is that the desired styles can be
written in one “.css” file. And this file can be called in our web pages to apply the styles.
CSE - 13 -
Full Stack Development Unit-I
Example:
<html>
<head>
<link rel = “stylesheet” type = “text/css” href = “external.css”>
</head>
<body>
<p>This is Internal CSS.</p>
</body>
</html>
external.css:
p
{
text-align: justify;
background-color: red;
}
CSS Selectors:
CSS selectors are used to "find" (or select) HTML elements based on their element name,
id, class, attribute, and more.
The id Selector:
The id selector uses the id attribute of an HTML element to select a specific element. The id of
an element should be unique within a page, so the id selector is used to select one unique
element! To select an element with a specific id, write a hash (#) character, followed by the id of
the element. The style rule below will be applied to the HTML element with id="para1":
Example:
#para1 {
text-align: center;
color: red;
}
CSE - 14 -
Full Stack Development Unit-I
The class Selector:
The class selector selects elements with a specific class attribute. To select elements with a
specific class, write a period (.) character, followed by the name of the class. In the example
below, all HTML elements with class="center" will be red and center-aligned:
Example:
.center {
text-align: center;
color: red;
}
You can also specify that only specific HTML elements should be affected by a class. In the
example below, only <p> elements with class="center" will be center-aligned:
Example:
p.center {
text-align: center;
color: red;
}
HTML elements can also refer to more than one class. In the example below, the <p> element
will be styled according to class="center" and to class="large":
Example:
<p class="center large">This paragraph refers to two classes.</p>
Now, what we want to do is to have the header take up the whole of the top row, with the menu
and content underneath, arranged side by side. To do this we would use the following CSS (the
header section doesn't require any CSS):
#menu {
float: left;
}
CSE - 15 -
Full Stack Development Unit-I
#content {
float: left;
}
#menu {
float: left;
width: 10em;
}
Widths can be specified in pixels, ems or as a percentage of the total page width.
The CSS clear property
We have seen how we can position HTML elements next to each other using CSS, but
sometimes we might want an element to appear beneath other elements. We can easily force an
element to sit below another using the clear property. When using clear, we can tell an element
to either clear those elements which are floated left, those which are floated right, or both:
Example:
#divname {
clear: left / right / both;
}
Changing Background:
The CSS background properties are used to define the background effects for elements.
CSS background properties:
background-color
background-image
background-repeat
background-attachment
background-position
Background Color
The background-color property specifies the background color of an element. The
background color of a page is set like this:
Example
body {
background-color: lightblue;
}
With CSS, a color is most often specified by:
A valid color name - like "red"
A HEX value - like "#ff0000"
An RGB value - like "rgb(255,0,0)"
CSE - 16 -
Full Stack Development Unit-I
Background Image:
The background-image property specifies an image to use as the background of an
element. By default, the image is repeated so it covers the entire element. The background image
for a page can be set like this:
Example:
body {
background-image: url("paper.gif");
}
CSE - 17 -
Full Stack Development Unit-I
Background Image - Fixed position
To specify that the background image should be fixed (will not scroll with the rest of the
page), use the background-attachment property:
Example:
body {
background-image: url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
The border-width property specifies the width of the four borders. The width can be set as a
specific size (in px, pt, cm, em, etc) or by using one of the three pre-defined values: thin,
medium, or thick. The border-width property can have from one to four values (for the top
border, right border, bottom border, and the left border).
CSE - 18 -
Web Technologies (A60512) Unit-V
Example
p.one {
border-style: solid;
border-width: 5px;
}
p.two {
border-style: solid;
border-width: medium;
}
p.three {
border-style: solid;
border-width: 2px 10px 4px 20px;
}
The border-color property is used to set the color of the four borders. The color can be set by:
name - specify a color name, like "red"
Hex - specify a hex value, like "#ff0000"
RGB - specify a RGB value, like "rgb(255,0,0)"
transparent
The border-color property can have from one to four values (for the top border, right border,
bottom border, and the left border). If border-color is not set, it inherits the color of the
element.
Example
p.one {
border-style: solid;
border-color: red;
}
p.two {
border-style: solid;
border-color: green;
}
p.three {
border-style: solid;
border-color: red green blue yellow;
}
CSE 19
Web Servers UNIT-I
Web Servers
Web pages are a collection of data, including images, text files, hyperlinks,
database files etc., all located on some computer (also known as server space)
on the Internet. A web server is dedicated software that runs on the server-
side. When any user requests their web browser to run any web page, the
webserver places all the data materials together into an organized web page
and forwards them back to the web browser with the help of the Internet.
Therefore, we can conclude that: -
This intercommunication of a web server with a web browser is done with the
help of a protocol named HTTP (Hypertext Transfer Protocol). These stored
web pages mostly use static content, containing HTML documents, images,
style sheets, text files, etc. However, web servers can serve static as well as
dynamic contents. Web Servers also assists in emailing services and storing
files. Therefore it also uses SMTP (Simple Mail Transfer Protocol) and FTP (File
Transfer Protocol) protocols to support the respective services. Web servers
are mainly used in web hosting or hosting the website's data and running
web-based applications.
Page | 20
Web Servers UNIT-I
The hardware of the web servers are connected to the Internet that manages
the data exchange facility within different connected devices. In contrast, the
software of web server software is responsible for controlling how a user
accesses delivered files. Typically, web server management is an ideal example
of the client/server model. Therefore, it is compulsory for all computers that
host websites (whether with state or dynamic web page content) to have
web server software.
Page | 21
Web Servers UNIT-I
servers are connected to the web and supports the data exchange with
different devices connected to the Internet.
2. On the software side, a web server includes server software accessed
through website domain names. It controls how web users access the
web files and ensures the supply of website content to the end-user. The
web server contains several components, including an HTTP server.
Many Web servers, even the basic one, also support the server-side scripting
technique. Server-side scripting is a web development method used to employ
scripts on a web server that produces a customized response for each user.
This technique operates on the server machine and consists of an extensive
feature set, including database access. The server-side scripting process will
have various scripting languages
such ASP, PHP, Java, JavaScript, Python, ruby and many more. This technique
also enables the HTML files to be created dynamically.
Web server software available in the market
Though there are various web servers found in today's market, but the
commonly used one are as follows:
Page | 23
Web Servers UNIT-I
3. Nginx
Nginx is an open-source web server commonly used by administrators
as it supports light resource application and scalability.
4. Lighttpd
Lighttpd, also known as lighty, is a free, open-source web server with
the FreeBSD operating system. This web server is fast, secure and
consumes much less CPU power. It can also run on the commonly used
operating system, unlike Windows, Mac OS X, Linus.
Page | 24
Shell Scripting & UNIX CLI UNIT-I
Also, the term is more generally used to define the automated mode of
executing an operating system shell; all operating systems use a specific name
for the functions such as mainframe operating systems, shell scripts (third-
party derivatives and Windows NT stream like 4NT), VMS (command
procedures), and batch files (OS/2, MSDos-Win95 stream) are related to
several terms.
Commonly, shells represent in Unix-like and Unix systems, such as the GNU
Bash, the Bourne shell, and the Korn shell. These shells are generally
represented for backward compatibility, while the Unix operating system may
contain a distinct default shell like MacOS upon zsh.
Comments are avoided by the shell. Typically, they start with the hash (#)
symbol and continue until the completion of the line.
Page | 25
Shell Scripting & UNIX CLI UNIT-I
o Shortcuts
A shell script can offer an easy variation of the system command in which
unique environment settings, post-processing, or command options
automatically apply, but in a form that permits the new script to act as a
completely normal Unix command.
1. #!/bin/ sh
2. LC_COLLATE=C ls -FCas "$@"
In the above example, the first line applies shebang to represent which
interpreter should run the rest of the script. The other line creates a listing
using options for several file format columns, indicators, all files, and sizes in
blocks. The LC_COLLATE=C configures the default collation sequence for not
folding lower and uppercase together.
Another shell script example that could be run as a shortcut would be to show
all file and directory lists in a given directory.
1. #!/bin/ sh
2. clear
3. ls -al
Page | 26
Shell Scripting & UNIX CLI UNIT-I
In the above example, the shell script would begin with its common beginning
line of #!/bin/ sh. Following it, the script runs the clear command, which clears
the command-line of every text before the next line. The ls -al command will
list the directories and files in the directory through which the script is being
executed. The attributes of the ls command could be modified to reflect the
requirements of the user.
o Batch jobs
o Generalization
Common batch jobs are usual for separated tasks, but using shell variables,
tests, and loops gives much more compliance to users. The POSIX sh script is
used to transform JPEG images into PNG images, in which the image titles are
given possibly by wildcards in the command-line rather than all being listed in
the script; it can be made with this file, generally saved inside a file such
as /home/username/bin/jpg2png.
o Programming
Also, several modern shells supply many features generally detected only in
more practical general-purpose programming languages like subroutines,
arrays, comments, variables, control flow constructs, and so on. With these
types of features available, it's possible to reasonably write practical
applications as shell scripts.
Although, they are still restricted by the fact that almost all shell languages
have no or little support for complex math, data typing systems, threading,
classes, and other basic full language aspects, and are also much slower than
Page | 27
Shell Scripting & UNIX CLI UNIT-I
The standard awk and sed Unix tools give additional capabilities for shell
programming. Also, Perl can be installed in shell scripts as other scripting
languages such as Tcl. Tcl and Perl also provide graphics toolkits.
Syntax:
1. echo $SHELL
Look at the above snapshot, with the help of above command we got the
name of our shell which is 'bash'.
The $ sign stands for a shell variable, echo will return the text whatever you
typed in.
What is CLI?
CLI stands for Command Line Interface. It is an interface for the user that is
used to issue commands in successive lines of text or command lines to
execute the tasks. It is a platform or medium in which users react to a visible
prompt by writing a command and receiving a response from the system, and
the users have to be compelled to type command or train of command to
execute the task. It is suitable for high-priced computing where input accuracy
is critical.
Page | 28
Shell Scripting & UNIX CLI UNIT-I
UNIX's operating systems include a CLI, whereas Windows and Linux include
both a CLI and a GUI. The user must have good knowledge of using the CLI
and complete knowledge of the correct syntax to issue effective commands.
Overall, the CLI uses less memory and executes faster than the GUI.
Advantages
Page | 29
Shell Scripting & UNIX CLI UNIT-I
Disadvantages
1. It's difficult to remember all of the CLI's commands. For CLI, UNIX
provides over 100 Some commands are combined with others and
remembering the order of the commands might be difficult.
2. The mostly commands in CLI may not be undone or reversed. So, the
users must be very careful to use the commands in CLI. In most cases,
the command's execution is not interrupted, and it continues.
3. Learning commands is a lengthy process. If users do not use commands
regularly, they will forget the majority of them. Each program has its set
of commands to execute.
4. If users write wrong commands or create a typo, the file may be deleted
or moved to the wrong location. If users delete a file by accident, it
causes difficulties because it may contain crucial information.
5. CLI might be perplexing to new users. The new user has no idea how the
CLI works or what to write in it.
Page | 30
Git(Global Information Tracker) UNIT-I
What is Git?
Git(Global Information Tracker) is an open-
source distributed version control system. It is
designed to handle minor to major projects with
high speed and efficiency. It is developed to co-
ordinate the work among the developers. The
version control allows us to track and work
together with our team members at the same workspace.
Git is foundation of many services like GitHub and GitLab, but we can use Git
without using any other Git services. Git can be used privately and publicly.
Git was created by Linus Torvalds in 2005 to develop Linux Kernel. It is also
used as an important distributed version-control tool for the DevOps.
Git is easy to learn, and has fast performance. It is superior to other SCM tools
like Subversion, CVS, Perforce, and ClearCase.
Features of Git
Some remarkable features of Git are as follows:
Page | 31
Git(Global Information Tracker) UNIT-I
o Open Source
Git is an open-source tool. It is released under the GPL (General Public
License) license.
o Scalable
Git is scalable, which means when the number of users increases, the Git
can easily handle such situations.
o Distributed
One of Git's great features is that it is distributed. Distributed means
that instead of switching the project to another machine, we can create
a "clone" of the entire repository. Also, instead of just having one central
repository that you send changes to, every user has their own repository
that contains the entire commit history of the project. We do not need
to connect to the remote repository; the change is just stored on our
local repository. If necessary, we can push these changes to a remote
repository.
Page | 32
Git(Global Information Tracker) UNIT-I
o Security
Git is secure. It uses the SHA1 (Secure Hash Function) to name and
identify objects within its repository. Files and commits are checked and
retrieved by its checksum at the time of checkout. It stores its history in
such a way that the ID of particular commits depends upon the
complete development history leading up to that commit. Once it is
published, one cannot make changes to its old version.
o Speed
Git is very fast, so it can complete all the tasks in a while. Most of the git
operations are done on the local repository, so it provides a huge
speed. Also, a centralized version control system continually
communicates with a server somewhere.
Performance tests conducted by Mozilla showed that it was extremely
fast compared to other VCSs. Fetching version history from a locally
stored repository is much faster than fetching it from the remote server.
The core part of Git is written in C, which ignores runtime overheads
associated with other high-level languages.
Git was developed to work on the Linux kernel; therefore, it
is capable enough to handle large repositories effectively. From the
beginning, speed and performance have been Git's primary goals.
o Supports non-linear development
Git supports seamless branching and merging, which helps in
visualizing and navigating a non-linear development. A branch in Git
represents a single commit. We can construct the full branch structure
with the help of its parental commit.
o Branching and Merging
Branching and merging are the great features of Git, which makes it
different from the other SCM tools. Git allows the creation of multiple
branches without affecting each other. We can perform tasks
like creation, deletion, and merging on branches, and these tasks take
Page | 33
Git(Global Information Tracker) UNIT-I
a few seconds only. Below are some features that can be achieved by
branching:
o We can create a separate branch for a new module of the
project, commit and delete it whenever we want.
o We can have a production branch, which always has what goes
into production and can be merged for testing in the test branch.
o We can create a demo branch for the experiment and check if it is
working. We can also remove it if needed.
o The core benefit of branching is if we want to push something to a
remote repository, we do not have to push all of our branches. We
can select a few of our branches, or all of them together.
o Data Assurance
The Git data model ensures the cryptographic integrity of every unit of
our project. It provides a unique commit ID to every commit through
a SHA algorithm. We can retrieve and update the commit by commit
ID. Most of the centralized version control systems do not provide such
integrity by default.
o Staging Area
The Staging area is also a unique functionality of Git. It can be
considered as a preview of our next commit, moreover,
an intermediate area where commits can be formatted and reviewed
before completion. When you make a commit, Git takes changes that
are in the staging area and make them as a new commit. We are
allowed to add and remove changes from the staging area. The staging
area can be considered as a place where Git stores the changes.
Although, Git doesn't have a dedicated staging directory where it can
store some objects representing file changes (blobs). Instead of this, it
uses a file called index.
Page | 34
Git(Global Information Tracker) UNIT-I
Another feature of Git that makes it apart from other SCM tools is that it
is possible to quickly stage some of our files and commit them
without committing other modified files in our working directory.
o Maintain the clean history
Git facilitates with Git Rebase; It is one of the most helpful features of
Git. It fetches the latest commits from the master branch and puts our
code on top of that. Thus, it maintains a clean history of the project.
Benefits of Git
A version control application allows us to keep track of all the changes that
we make in the files of our project. Every time we make changes in files of an
existing project, we can push those changes to a repository. Other developers
are allowed to pull your changes from the repository and continue to work
with the updates that you added to the project files.
Page | 35
Git(Global Information Tracker) UNIT-I
o Saves Time
Git is lightning fast technology. Each command takes only a few seconds
to execute so we can save a lot of time as compared to login to a
GitHub account and find out its features.
o Offline Working
One of the most important benefits of Git is that it supports offline
working. If we are facing internet connectivity issues, it will not affect
our work. In Git, we can do almost everything locally. Comparatively,
other CVS like SVN is limited and prefer the connection with the central
repository.
o Undo Mistakes
One additional benefit of Git is we can Undo mistakes. Sometimes the
undo can be a savior option for us. Git provides the undo option for
almost everything.
Page | 36
Git(Global Information Tracker) UNIT-I
Why Git?
We have discussed many features and benefits of Git that demonstrate the
undoubtedly Git as the leading version control system. Now, we will discuss
some other points about why should we choose Git.
o Git Integrity
Git is developed to ensure the security and integrity of content being
Page | 37
Git(Global Information Tracker) UNIT-I
Page | 38
Git(Global Information Tracker) UNIT-I
Now the question arises that how to download the Git installer package.
Below is the stepwise installation process that helps you to download and
install the Git.
Step1
To download the Git installer, visit the Git's official site and go to download
page. The link for the download page is https://git-scm.com/downloads. The
page looks like as
Click on the package given on the page as download 2.23.0 for windows.
The download will start after selecting the package.
Install Git
Page | 39
Git(Global Information Tracker) UNIT-I
Step2
Click on the downloaded installer file and select yes to continue. After the
selecting yes the installation begins, and the screen will look like as
Step3
Default components are automatically selected in this step. You can also
choose your required part.
Step4
The default Git command-line options are selected automatically. You can
choose your preferred choice. Click next to continue.
Step5
The default transport backend options are selected in this step. Click next to
continue.
Page | 41
Git(Global Information Tracker) UNIT-I
Step6
Select your required line ending option and click next to continue.
Step7
Page | 42
Git(Global Information Tracker) UNIT-I
Step8
This is the last step that provides some extra features like system caching,
credential management and symbolic link. Select the required features and
click on the next option.
Step9
Page | 43
Git(Global Information Tracker) UNIT-I
Therefore, The Git installation is completed. Now you can access the Git
Gui and Git Bash.
The Git Gui looks like as
Page | 44
GitHub UNIT-I
GitHub
GitHub is an immense platform for code hosting. It
supports version controlling and collaboration.
Here, we will learn GitHub essentials like a repository, branches, commits, pull
requests, and more. Further, we will learn how to use GitHub and will create
our first project on it.
What is GitHub?
GitHub is an immense platform for code hosting. It supports version
controlling and collaboration and allows developers to work together on
projects. It offers both distributed version control and source code
management (SCM) functionality of Git. It also facilitates collaboration features
such as bug tracking, feature requests, task management for every project.
o Repositories
o Branches
o Commits
o Pull Requests
o Git (the version control tool GitHub is built on)
Page | 45
GitHub UNIT-I
Advantages of GitHub
GitHub can be separated as the Git and the Hub. GitHub service includes
access controls as well as collaboration features like task management,
repository hosting, and team management.
Features of GitHub
GitHub is a place where programmers and designers work together. They
collaborate, contribute, and fix bugs together. It hosts plenty of open source
projects and codes of various programming languages.
Page | 46
GitHub UNIT-I
o Collaboration
o Integrated issue and bug tracking
o Graphical representation of branches
o Git repositories hosting
o Project management
o Team management
o Code hosting
o Track and assign tasks
o Conversations
Page | 47
GitHub UNIT-I
GitHub Git
It is an online service that is used to Git tool is installed on our local machine
store code and push from the for version controlling and interacting
computer running Git. with online Git service.
It provides a desktop interface called The desktop interface of Git is called Git
GitHub desktop GUI. GUI.
Page | 48
GitHub UNIT-I
Fill the necessary details under sign up like your name, email address, and
password. Then click on the Next: Select a plan option.
Page | 49
GitHub UNIT-I
Under the above option, you will see the plan. Select your plan, whether you
want to be a pro member, or would like to continue with a free account.
After selecting a plan, a confirmation link will send to your email address.
Activate your account by clicking on the received link, and you are ready to go
with GitHub.
GitHub Login
Log in to your GitHub account to use the GitHub service. To login to your
account, click on the Sign-in option on the upper right corner. It will ask you
for your email id and password. You can log in by entering your credentials. At
your first login, the homepage will ask you to create your first repository and
some other options like exploring the repository.
Page | 50
GitHub UNIT-I
GitHub Repository
The repositories are the data structures used by GitHub to store metadata for
files and directories. It encloses the collection of the files as well as the history
of changes made to those files. Generally, the repository is considered a
project folder. A single project can have more than one repository.
Create a repository
We can create an unlimited public repository and unlimited private repository
(For the pro user) on GitHub. To create a repository on GitHub, click on the '+'
symbol on the upper right corner on the login screen.
There are some other options available like import repository, gist,
organization, and new project. To create a repository, choose New
repository option from the given list. When you first log in to your account,
you will see the UI as follows:
Page | 51
GitHub UNIT-I
GitHub asks you to learn Git and GitHub without any code. It will ask you to
read the hello world guide for the first uses. Also, you can create a repository
(Project) from here.
Click on the new repository option and then fill the required details like
repository name, description, and select the access of this repository. You can
also initialize the repository with a README file. After filling all the details, click
on the Create Repository option. It will create a repository for you. Consider
the below image:
Page | 52
GitHub UNIT-I
Hence we have created a repository and set its access. Now, we are all set to
create our first file. Let's create a file:
Page | 53
GitHub UNIT-I
Create a file
In GitHub, creating a file is a straight forward process. Let's create a file in our
newly created repository. Consider the below snap of our repository:
There are distinct options available to add files to the repository. GitHub
allows us to design and upload files. To create a file, click on the 'Create new
file' option. It will open a file structure, and it will look like as follows:
Page | 54
GitHub UNIT-I
Enter the file name on the box and type the code on the editor area.
At the bottom of the page, the commit options are available. Consider the
below snap:
In the above image, we can give the commit message in the first text area and
the description in the second text area. Also, we can specify whether we want
to commit it to the master branch or want to create a new branch.
Click on the 'commit new file' option. We have successfully added and
committed a new file to our repository.
We can edit and delete this file from our project. There are many options
available, like edit, delete, Raw, Blame, and history. Consider the below snap of
the file.
Page | 55
GitHub UNIT-I
Hence we have learned how to create a file and commit changes. Now we will
see how to create a new branch.
It is complex to merge the unstable code with the main code base and also
facilitates you to clean up your future history before merging with the main
branch.
Also, we can create the branch when we add a file or make some commit. It
asks to commit the changes in the existing branch or create a new one.
Page | 56