From the course: Complete Guide to Git
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Patch mode - Git Tutorial
From the course: Complete Guide to Git
Patch mode
- [Instructor] In this movie, we will learn how to use patch mode, which is the most useful feature of interactive staging. Patch mode allows us to select only certain portions of a file to add to the staging index. From the regular command line, we can only add entire files. Patch mode is very useful if one file has several changes, but they aren't all related to the commit that you want to make. The interactive mode lets us pick changes by groups of lines. Git divides up the changes that are in a file into groups that it calls hunks. A hunk can be staged, skipped over, or split into smaller hunks. This is easiest to understand if we try it. I'm inside my Big_Star_Collectibles repository and on the main branch. If you don't already have several edits in one file, then take a few minutes to make some. I'm going to undo the last commit I made and use those changes. If you'll remember, I just committed the changes that were in the about page. There's a bunch of changes there you can…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.