WEEK 7 · LESSON 5 · TOPIC 4 OF 6 · Practical Application

Practical Application

Lesson progress

0% Complete

SECTION 1 OF 1

In this topic · 1 sections
  1. Overview

Overview

Scenario A: A file was edited incorrectly but not staged.

git status
git restore 1.txt
git status

Scenario B: Several changes were staged together by mistake.

git status
git reset
git status

Then stage only the intended files.

Scenario C: A tracked file should be deleted and included in the next commit.

git rm 4.txt
git status
git commit -m "Remove 4.txt"

Scenario D: A local file should remain on disk but no longer be tracked.

git rm --cached 4.txt
git status

Scenario E: An earlier commit introduced a mistake that should be visibly corrected.

git log --oneline
git revert <commit-id>
git log --oneline

The log now contains both the original commit and the later revert commit.