How to Backtrack in Git

Learn different ways to undo changes made to a Git project and when to use them.

Start[missing "en.views.course_landing_page.learn-git.course_illustration" translation]
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 [...] commit. In many cases, the most recently made commit is the [...] commit. To see the [...] commit, enter: [...] The output ...

  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 [...] , notice the diagram on the right. Each circle represents a commit. Before reset: [...] is at the most recent commit After resetting: [...] goes to ...

  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: * [....

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

How to Backtrack in Git

Start[missing "en.views.course_landing_page.learn-git.course_illustration" translation]