When I make changes to a file in Git, how can I commit only some of the changes?
For example, how could I commit only 15 lines out of 30 lines that have been changed
If it's on Windows
platform, in my opinion git gui
is very good tool to stage
/commit
few lines from unstaged
file
1. Hunk wise:
unstagged Changes
sectionStage Hunk for commit
2. Line wise:
unstagged Changes
section Stage Lines for commit
3. If you want to stage the complete file except couple of lines:
unstagged Changes
sectionCtrl+T (Stage file to commit)
Staged Changes
SectionUnStage Lines for commit