Key Concepts

Review core concepts you need to learn to master this subject

Showing Latest Commit Log

$ git show HEAD commit 735359632f3ca3fe572484a4ec3e0d7b0d9c8f2d Author: codecademy <[email protected]> Date: Wed Jul 6 10:20:58 2016 -0400 scene-5.txt diff --git a/scene-5.txt b/scene-5.txt index b12dd97..5dd5d4e 100644 --- a/scene-5.txt +++ b/scene-5.txt @@ -12,3 +12,7 @@ Hamlet: I will. +Ghost: +My hour is almost come, +When I to sulphurous and tormenting flames +Must render up myself. \ No newline at end of file

In Git, the commit you are currently on is known as the HEAD commit.

The output of the git show HEAD command will display everything the git log command displays for the HEAD commit, plus all the file changes that were committed.

How to Backtrack
Lesson 1 of 1
  1. 1
    When working on a Git project, sometimes we make changes that we want to get rid of. Git offers a few eraser-like features that allow us to undo mistakes during project creation. In this lesson, we…
  2. 2
    In Git, the commit you are currently on is known as the HEAD commit. In many cases, the most recently made commit is the HEAD commit. To see the HEAD commit, enter: git show HEAD The output o…
  3. 3
    What if you decide to change the ghost’s line in the working directory, but then decide you wanted to discard that change? You could rewrite the line how it was originally, but what if you forgot …
  4. 4
    The hamlet repository we are working on contains five files. In Git, it’s common to change many files, add those files to the staging area, and commit them to a repository in a single commit. …
  5. 5
    Great! The files you’ve added to the staging area belong in the same commit. What if, before you commit, you accidentally delete an important line from scene-2.txt? Unthinkingly, you add __sce…
  6. 6
    Creating a project is like hiking in a forest. Sometimes you take a wrong turn and find yourself lost. Just like retracing your steps on that hike, Git enables you to rewind to the part before you…
  7. 7
    To better understand git reset commit_SHA, notice the diagram on the right. Each circle represents a commit. Before reset: * HEAD is at the most recent commit After resetting: * HEAD g…
  8. 8
    Congratulations! You’ve learned three different ways to backtrack in Git. You can use these skills to undo changes made to your Git project. Let’s take a moment to review the new commands: * git…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo