Check out a free preview of the full Git In-depth course
The "Local and Remote Destructive Operations" Lesson is part of the full, Git In-depth course featured in this preview video. Here's what you'd learn in this lesson:
Nina reviews destructive operations that endanger changes lost forever.
Transcript from the "Local and Remote Destructive Operations" Lesson
[00:00:00]
>> Nina Zakharenko: Hopefully you all were able to grab a fork of my repository, and update your remotes to point to it. We're gonna use this a little bit later for a different exercise.
>> Nina Zakharenko: Before our final wrap up, where we're gonna talk about GitHub a little bit more. I wanna reiterate the dangerous zone.
[00:00:26]
So these are all the local destructive operations that you might be able to take. git checkout -- file, git reset -- hard. In this case, if you do one of these operations on files that have changes, there's no path to recovery unless you had a copy somewhere else.
[00:00:44]
I highly recommend stashing them. If you're lucky and you stash the changes, that's great. But really for this reason, remember to commit early and often. It's a great. You can always clean up your local history at any point in time.
>> Nina Zakharenko: Destructive operations for a remote, rewriting history, rebase, amend, reset.
[00:01:09]
If you do any of these things, don't ever run git push -f if your code is hosted or shared. Super important.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops