Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

freeCodeCamp

How to Undo Mistakes With Git Using the Command Line

via freeCodeCamp

Overview

Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This course teaches how to undo local changes, restore deleted files and commits, reset revisions, and modify Git history using command-line workflows. It covers the reflog, branch recovery, and interactive rebase, with cautions about rewriting shared commits.

Syllabus

) Introduction.
) Hosted by Tower.
) Git as your safety net.
) Discard all local changes in a file.
) Please be careful: discarding local changes cannot be undone!.
) Restoring deleted files.
) Discard chunks / lines in a file.
) Discarding all local changes.
) Fixing the last commit.
) What "rewriting history" means.
) Reverting a commit in the middle.
) Resetting to an old revision.
) Resetting a file to an old revision.
) The Reflog.
) Recovering deleted commits.
) Recovering deleted branches.
) Moving a commit to a new branch.
) Moving a commit to a different branch.
) Interactive Rebase: an overview of what you can do.
) Interactive Rebase: how it works in general.
) Editing old commit messages with Interactive Rebase.
) Deleting commits with Interactive Rebase.
) Squashing multiple commits into one with Interactive Rebase.
) Adding changes to an old commit with Interactive Rebase.
) Splitting/editing an old commit with Interactive Rebase.
) Reminder: don't rewrite commits that you have already shared!.
) First Aid Kit for Git: a set of short videos and a cheat sheet, free to download (www.bit.ly/git-first-aid-kit).

Taught by

freeCodeCamp.org

Reviews

Start your review of How to Undo Mistakes With Git Using the Command Line

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.