Uncover the Secret Code Changes

Beginner

Introduction

Welcome, Git Diff Detective! Your team has been working on a top-secret project, but someone has made unauthorized changes to the code. Your mission is to use your git diff skills to uncover these changes and identify the affected files. This challenge will test your ability to compare different states of your repository and pinpoint specific modifications.

Investigate the Secret Project Repository

Before you begin, note that a Git repository has been set up for you at ~/project/secret-project. This repository contains the original code and the mysterious changes. Your workspace is already initialized and ready for investigation.

Tasks

  1. Navigate to the secret project repository at ~/project/secret-project.
  2. Use Git diff commands to identify the files that have been modified but not yet staged.
  3. Determine which files have changes staged for commit.
  4. Find the specific line that was added to the file encryption.js.

Requirements

  • All operations should be performed in the ~/project/secret-project directory.
  • You need to identify:
    • The names of files with unstaged changes
    • The names of files with staged changes
    • The exact line added to encryption.js
  • Fill in the ~/investigation_report.txt file with your findings. A template has been provided for you. You can open and edit the file using a text editor on the desktop.

Example

After successfully completing the challenge, your ~/investigation_report.txt might look something like this:

Unstaged files:
xxx.js
xxx.js

Staged files:
xxx.js
xxx.js

Added line in encryption.js:
const ……

Make sure to replace xxx.js with the actual filenames and const …… with the exact line that was added. Don't change the format of the report, including the blank lines.

Summary

In this challenge, you've put your git diff investigation skills to the test. You've learned how to use different options of the git diff command to examine changes in various states of your Git repository. This skill is crucial for understanding what changes have been made to your project, whether they're staged for commit or still in your working directory.

Remember, git diff is a powerful tool for reviewing changes before committing, understanding the current state of your project, and even for debugging. By mastering these skills, you're well on your way to becoming a true Git detective, capable of uncovering any mysterious changes in your codebase!