Discarding Chunks / Lines in a File
In this episode, we will learn how to undo only certain changes in a file - down to the level of chunks and even individual lines of code!
Transcript
In a previous video, I’ve already demonstrated how to restore a modified file. In this video, however, I’ll get a lot more granular - because I’ll show you how to undo only certain parts and even lines in a modified file!
So, let’s say that we’re not happy with all of the changes we’ve made in "imprint.html". You can simply choose to discard either a whole chunk of changes - or even just specific lines of code.
Of course, this is not limited to discarding changes - you can also add them to the staging area in this way. That is a very powerful way to deal with your changes, and ultimately to create really precise commits.
Course outlineEpisode 3 of 17
- Discarding All Local Changes in a File
- Restoring a Deleted File
- Discarding Chunks / Lines in a File
- Discarding All Local Changes
- Fixing the Last Commit
- Reverting a Commit in the Middle
- Resetting to an Old Revision
- Resetting a File to an Old Revision
- Recovering Deleted Commits
- Recovering a Deleted Branch
- Moving a Commit to a New Branch
- Moving a Commit to a Different Branch
- Editing Old Commit Messages
- Deleting Old Commits
- Squashing Multiple Commits into One
- Adding a Change to an Old Commit
- Splitting / Editing an Old Commit