How to do it...

Load Git GUI in the Git-Version-Control-Cookbook-Second-Edition_tips_and_tricks repository. Here, you can see the unstaged changes (files) at the top-left and the staged changes (files) underneath. The main window will display the unstaged changes in the current marked file. You can right-click on a hunk and see a context menu with options for staging and so on. The first hunk shown by Git GUI is much larger than what we saw before with git add -p. Choose Show Less Context to split the hunk, as shown in the following screenshot:

Now, we get a smaller hunk like before, as shown in the following screenshot:

For the first hunk, we just choose to add Stage Hunk For Commit, and the next hunk moves to the top of the screen, as shown in the next screenshot:

Here, we can select the lines we want to add, instead of performing another split, and stage those lines: Stage Lines For Commit. We can add the rest of the hunks except the one with the debug line. Now, we are ready to create a commit and we can do so from the Git GUI. We can just write the commit message in the field at the bottom of the screen and hit Commit, as shown in the next screenshot:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.129.100