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

Roll back local branch changes - GitHub Tutorial

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

Roll back local branch changes

- [Instructor] There are a number of ways to rollback changes, that is go back to the original state of a particular branch. In this example, I've been working with a new line of code that I added to my Java class. To rollback your changes go to the Commit window. And once again, you can get there by clicking on this icon on the Git toolbar or by pressing the associated keyboard shortcut. And let's say we wanted to rollback just the changes in my main.java file. So, I'm going to click here to de-select all, and then only select main.java. And then, I can click this icon to rollback. And, again, notice that there's an associated keyboard shortcut. I get this dialogue to confirm the change. I can click Rollback and the change is gone. And now I'm back at that original state. You could also decide to rollback everything and that would include changes, and new files that have been created. So, I could select this entire change list, check that check box to select everything, and roll everything back. Now that's going to remove files from the Git system, but it won't actually delete the files that have been created. Those files may appear here now under Unversioned Files. If you want to re-add them to Git you can select them, right-click and choose Add to VCS. And now they'll show up in your change list again. So, rolling back code changes truly rolls back to the original state of the file. Rolling back changes to files you created since the last time you committed doesn't actually delete the files. It just moves them to an unversioned state and then you can re-add them to Git as you need.

Contents