Module- 6
Managing Source Code – Git and GitHub
Submitted by - Pavani Dubasi
Submitted To – Vikul
Batch No. SA2503057
Date of Submission – 15-06-2025
1. L1 - Create Local git repository and demonstrate all git reset
options and revert. Compare the differences
Step 1: Create Local git repository
Step 2: Demonstrate all git reset options and revert
Gits revert:
It is used to undo changes introduced by a specific commit
while preserving the commit history.
Syntax:
git revert commit id
git revert Head
git revert HEAD~<number>
git revert commit id –no-edit
git revert <commit1> <commit2>…
Git Reset:
It is used to move the HEAD pointer to a specific commit, it
modifies the commit history by adjusting the Head pointer.
Syntax:
git reset commit id
git reset [--soft | --mixed | --hard] HEAD~<number>
git reset –soft commit id
git reset –mixed commit id
git reset –hard commit id
Step 3 – Compare the differences between git reset & revert
Git reset:
Purpose: Removes or undoes commits locally.
Affects history: Alerts the commit history.
Usage: When working locally or on private branches.
Safety: Risky if commits are pushed to be a remote.
Working directory: Can affect the working directory and
staging area depending on the option used.
Undo Action: Can remove or modify commits in history.
Git revert:
Purpose: Create a new commit that undoes changes.
Affects history: Does not change Commit history.
Usage: When working on public/shared branches.
Safety: Safe for shared or public branches.
Working directory: Does not affect the working directory
directly.
Undo action: Reverse the changes in a new commit.
2. L2 - Create Local git repository and demonstrate git merge
and Merge Conflicts with the steps to resolve merge conflicts.
Step 1: Create a Local Git Repository & Create an Initial Commit
on the main Branch
Step 2: Create and Switch to a New Branch
Step 3: Modify file in the New Branch
Step 4: Switch Back to main and Make a Conflicting Change
Step 5: Merge new branch into main branch (Causes Conflict)
Step 6: Check the Conflict in file
Step 7: Resolve the Conflict Manually
Step 8: Add the Resolved File and Commit the Merge
Step 9: Confirm Merge Was Successful
3. L3 - Using Local and Remote git repositories demonstrate git
pull and git fetch. Compare the differences.
Git fetch- Command that tells your local git to retrieve the
latest meta-data info from the original.
Git pull- Command will get the latest changes from central
repository to the local repository.
Step 1: Create a Remote Repository on GitHub
Step 2: Create a Local Repository
Step 3: Add a File and Push to GitHub
Step 4: Clone Repo to Another Folder
Step 5: Make a Change in Original Repo and Push
Step 6: Use git fetch in the Clone
Step 7: Use git pull in the Clone
Git fetch:
Fetches updates from the remote repository but does not
automatically merge those changes into your current working
branch. It downloads the latest changes from the remote but
leaves your local working directory unchanged.
Git pull:
Does everything git fetch does fetches updates from the
remote and automatically merges the changes into your
current branch. It combines git fetch and git merge in one step,
so it immediately integrates the latest remote changes into
your working branch.
4. L4 - Clone GitHub repository using Visual Studio Code IDE
Step 1: Open VS Code
Step 2: Open the Command Palette
Step 3: Cloned Repo in VS Code
5. L5 - Push the incremental changes to GitHub Repository
through Visual Studio Code IDE
Step 1: Open Your Project in VS Code
Step 2: Make a Change
Step 3: Pushing code from VS code to GitHub
Step 4: Seeing changes in GitHub