0% found this document useful (0 votes)
54 views3 pages

Git & GitHub Version Control Guide

The document outlines an experiment to demonstrate version control operations using Git and GitHub, focusing on commit, branch, merge, and clone with a basic HTML project. It provides software requirements, objectives, and detailed procedures with examples for each operation. The expected outcome includes a successfully initialized repository, branch management, and remote collaboration through GitHub.

Uploaded by

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

Git & GitHub Version Control Guide

The document outlines an experiment to demonstrate version control operations using Git and GitHub, focusing on commit, branch, merge, and clone with a basic HTML project. It provides software requirements, objectives, and detailed procedures with examples for each operation. The expected outcome includes a successfully initialized repository, branch management, and remote collaboration through GitHub.

Uploaded by

kishwaryarani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Experiment: Demonstrate Version Control Operations – Commit, Branch, Merge,

Clone (Using Git & GitHub)

Aim:
To understand and demonstrate version control operations using Git and GitHub, including:
 commit
 branch
 merge
 clone
with suitable hands-on examples using a basic HTML project.

Software Requirements:
 Git (Installed from [Link]
 GitHub Account ([Link]
 Internet connection
 Code Editor (VS Code, Notepad++)
 Terminal / Git Bash

Objective:
1. Understand distributed version control system
2. Learn to use Git for local version control
3. Learn to use GitHub for remote collaboration
4. Demonstrate commit, branch, merge, and clone operations with examples

Operation Git Command Example


Init git init
Add File git add filename
Commit git commit -m "message"
Branch git checkout -b branchname
Merge git checkout main + git merge branchname
Clone git clone <repo-url>
Push git push origin branchname

Understanding Git Commands Used:


Operation Git Command Example
Initialize Git git init
Stage Changes git add filename
Commit git commit -m "commit message"
Changes
Create Branch git checkout -b new-branch-name
Merge Branch git merge branch-name
Push to GitHub git push origin branch-name
Clone Repo git clone [Link]

Procedure with Examples:


We'll use a basic HTML portfolio website with a single file: [Link].
1. Initialize a Git Repository Locally (git init)
➤ Steps:
1. Open Terminal or Git Bash
2. Create a project folder
mkdir portfolio-site
cd portfolio-site
3. Initialize Git:
git init
This creates a hidden .git folder inside the directory.

2. Create a Sample HTML File


echo "<!DOCTYPE html><html><head><title>My
Portfolio</title></head><body><h1>Welcome!</h1></body></html>" > [Link]

3. Commit Changes (git add, git commit)


➤ Steps:
git add [Link]
git commit -m "Initial commit: Added basic portfolio page"
This saves the changes to the local repository.

4. Create a New Branch (git branch)


➤ Steps:
git branch about
git checkout about
Or shortcut:
git checkout -b about
You are now working on a separate branch named about.

5. Make Changes on Branch and Commit


Open [Link] and add the following before </body>:
<p>This is the about section.</p>
Then:
git add [Link]
git commit -m "Added about section"

6. Merge Branch with Main (git merge)


Switch to main branch:
git checkout main
Then merge:
git merge about
Changes from about branch are now merged into main.

7. Push to GitHub (Remote Version Control)


➤ Steps:
1. Create a new repository on GitHub (e.g., portfolio-site)
2. Connect local repo to GitHub:
git remote add origin
[Link]
git push -u origin main
8. Clone Repository (git clone)
You can now clone the repository on another system or folder:
git clone [Link]
This copies the entire project (including history and branches) to a new location.

Expected Output
 A repository initialized and committed locally.
 New branches created and merged.
 Project pushed to GitHub successfully.
 Repository cloned from GitHub.

Result
Successfully demonstrated version control operations: commit, branch, merge, and clone
using Git and GitHub.

Tips
 Use git log to see commit history.
 Use git status to see untracked/modified files.
 Use git branch -a to list all branches.

You might also like