Git Time Detective

GitGitBeginner
Practice Now

Introduction

Welcome, Git Time Detective! A crucial piece of code has gone missing from your team's project, and it's up to you to solve the mystery. Your mission is to use your Git log management skills to track down the missing code and identify the commit where it disappeared. This challenge will test your ability to search through Git history and filter logs effectively.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL git(("Git")) -.-> git/BasicOperationsGroup(["Basic Operations"]) git(("Git")) -.-> git/BranchManagementGroup(["Branch Management"]) git/BasicOperationsGroup -.-> git/diff("Compare Changes") git/BranchManagementGroup -.-> git/log("Show Commits") subgraph Lab Skills git/diff -.-> lab-387782{{"Git Time Detective"}} git/log -.-> lab-387782{{"Git Time Detective"}} end

Investigate the Git Repository

Before you begin, note that a Git repository has been set up for you at ~/project/mystery-repo. This repository contains a series of commits, including the one where our mystery function disappeared. Your workspace is already initialized and ready for investigation.

Tasks

  1. Navigate to the mystery repository at ~/project/mystery-repo.
  2. Use Git log commands to identify the commit where the function secretAlgorithm() was removed from the file secret.js.
  3. Find the author responsible for removing the function.

Requirements

  • You must use the git log command with appropriate options to complete this challenge.
  • All operations should be performed in the ~/project/mystery-repo directory.
  • You need to find the exact commit hash where the secretAlgorithm() function was removed.
  • You must identify the author who made the commit that removed the function.
  • Write the commit hash to a file named ~/user_answer.txt.
  • Write the author's name to a file named ~/user_author.txt.

Example

After successfully completing the challenge, you should be able to provide information similar to this:

cat ~/user_answer.txt
a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9
cat ~/user_author.txt
Jane Doe
โœจ Check Solution and Practice

Summary

In this challenge, you've put your Git history investigation skills to the test. You've learned how to use advanced git log features like the pickaxe option (-S) to search for specific code changes across your project's history. This skill is invaluable when tracking down when and why particular changes were made, especially in large projects with extensive history.

Remember, Git's history features are powerful tools for understanding your project's evolution. They can help you track down bugs, understand design decisions, and even recover lost code. Keep practicing these skills, and you'll become a true Git Time Detective, able to unravel any mystery in your project's history!