git undo only a chunk code example
Example: git undo only a chunk
Reset only chuncks from commit:
git reset HEAD^ -- filename # (very important to specifiy the file, otherwise the commit is deleted…)
git add -p -- filename. # To remove the lines you don’t want, replace the "-" symbol with " " (space) and delete the entire corresponding "+" line.