1.
Write code for a simple user registration
<div class="container">
<h1>Event Registration Form</h1>
<form name="Registration" class="registration-form" onsubmit="return formValidation()">
<table>
<tr>
<td><label for="name">Name:</label></td>
<td><input type="text" name="name" id="name" placeholder="Your Name"></td>
</tr>
<tr>
<td><label for="email">Email:</label></td>
<td><input type="text" name="email" id="email" placeholder="Your Email"></td>
</tr>
<tr>
<td><label for="password">Password:</label></td>
<td><input type="password" name="password" id="password"></td>
</tr>
<tr>
<td><label for="phoneNumber">Phone Number:</label></td>
<td><input type="number" name="phoneNumber" id="phoneNumber"></td>
</tr>
<tr>
<td><label for="gender">Gender:</label></td>
<td>
Male: <input type="radio" name="gender" value="male">
Female: <input type="radio" name="gender" value="female">
Other: <input type="radio" name="gender" value="other">
</td>
</tr>
<tr>
<td><label for="language">Language:</label></td>
<td>
<select name="language" id="language">
<option value="">Select Language</option>
<option value="English">English</option>
<option value="Spanish">Spanish</option>
<option value="Hindi">Hindi</option>
<option value="Arabic">Arabic</option>
<option value="Russian">Russian</option>
</select>
</td>
</tr>
<tr>
<td><label for="zipcode">Zip Code:</label></td>
<td><input type="number" name="zipcode" id="zipcode"></td>
</tr>
<tr>
<td><label for="about">About:</label></td>
<td><textarea name="about" id="about" placeholder="Write about yourself..."></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" class="submit" value="Register" /></td>
</tr>
</table>
</form>
</div>
2. Explore Git and GitHub Commands
1. Git Environment Setup
Prepares your system to use Git.
Install Git and verify it's working. Git is a distributed version control system used to track changes in
source code during software development. It allows multiple developers to work on the same project
simultaneously without conflicts.
Install Git
sudo apt install git –y
Installs Git on your system. The -y automatically accepts the installation.
Verify installation
git --version
Displays the installed Git version (e.g., git version 2.34.1).
2. git Config Command
Sets global configuration for Git like username and email.
Required before making commits. This ensures that each commit you make is tagged with your identity.
Git configuration also allows you to set preferences like default text editor, diff tools, and line endings.
Example:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
3. git init Command
Initializes a new Git repository in your folder.
Converts a folder into a Git project. This command sets up all the necessary files and folders Git needs to
start tracking your project. It creates a .git directory which holds metadata and version history.
Example:
git init
4. git status Command
Shows current status of files in the working directory.
To check which files are modified or staged. This helps identify untracked, modified, or staged files that
are ready for commit.
Example:
git status
Shows current status of files in the working directory. To check which files are modified or
staged.
5. git add Command
Adds changes/files to the staging area. Prepares files to be committed. This command lets you select
which changes should be included in the next commit.
Example:
git add filename
git add .
6. git commit Command
Saves changes to the local repository.
To create a checkpoint of your work. Commits record the staged snapshot to the project history. Always
write clear commit messages to describe your changes.
Example:
git commit -m "Your commit message"
7. git log Command
Shows the commit history.
View who changed what and when. This helps you track project history and understand the sequence of
changes made by all contributors.
Example:
git log
8. git diff Command
Shows file differences between commits or working tree.
To review what changed before committing. Useful for code review and understanding how your
changes differ from previous commits.
Example:
git diff
9. git clone Command
Copies a remote repository to your local system.
To start working on a project from GitHub. It downloads the repository and all its version history to your
local machine.
Example:
git clone repo_url
git remote add origin & git push origin master
Connects local repo to GitHub (`origin` is default name).
Upload code to GitHub. This links your local repository to a remote one so you can push changes and
collaborate with others.
Example:
git remote add origin https://github.com/user/repo.git
git push -u origin master
10.git push Command
Pushes local changes to a remote repository.
To upload commits. This syncs your local repository with the remote repository so others can see and
use your changes.
Example:
git push
11.git pull Command
Fetches and merges changes from remote.
To sync with GitHub. It is a combination of `git fetch` and `git merge`, allowing you to update your local
codebase.
Example:
git pull
12. git fetch Command
Downloads changes from remote but doesn’t merge.
To see what others have pushed before merging. Useful for reviewing changes before integrating them
into your local codebase.
Example:
git fetch