From the course: Working with LinkedIn Learning Exercise Files on GitHub

Roll back local branch changes with Restore - GitHub Tutorial

From the course: Working with LinkedIn Learning Exercise Files on GitHub

Roll back local branch changes with Restore

- [Instructor] There's a few other commands that you can try when working with the Repose. The first is reverting. Think of reverting as a reset of the code back to what it used to be. It's sort of like a stash, but without saving your changes. One time that you may want to either stash or revert is if you want to switch to a new video. If you try to switch to a different branch right now, but I've already made changes to files, you'll get a dialog box like this. Now here, you can choose to stash and check out, but sometimes you don't want to create random stashes. A cleaner thing to do is to revert the changes and then switch to the branch you want to try next. So I'm going to hit Cancel. I'll go back to the triple dot menu. And I'm going to go to Changes and select Discard All Changes. I've only changed one file, so I'm going to choose to discard this one file. This will bring the code back to how it looked like at the beginning of the video. Now I can switch to another branch. And that's how you switch to another branch safely when you've made some changes to the code.

Contents