How to commit part of file in git
In Magit, the Git interface for Emacs, you can commit part of a file using the following commands:
Stage Specific Hunks:
Navigate to the hunks you want to stage using the arrow keys or mouse.
Press s to stage the changes in the current hunk (shown as "Hunk 1" in image above).
Repeat it for each hunk you want to stage.
Explanation: This command stages specific hunks (chunks of changes) within the file, allowing you to selectively include changes in the next commit.
You are not limited to a single...
Read more at newbeelearn.com