I'm wondering if it's possible to only stage/commit the added parts (green) to the file and ignore the deleted parts (red)? Basically I don't want to override the file with the deleted parts and I just want to add the added parts .
Thanks!
Problem: Basically I don't want to override the file with the deleted parts and I just want to add the added parts
This is what I see (for unstaged file):
Solution: 1- Opening up settings (On window/linux File > Preferences > Setting. On macOS Code > Preferences > Settings) 2- Search for diff 3- The specific setting is Diff Editor:Render Side by Side. Mark the checkbox.
Un-stage the file so in sidebar it moves to "Changed" category. Click it on the sidebar.
You should see old & new side by side. If there are changes you don't want to commit (they aren't your edits, maybe they should belong in another branch etc) you should see arrows to undo the change, put the old block back.
Click the arrow next to the red blocks (or copy paste them from left to right but that's more work). Save the file. (I hope you don't have autodeployment on save). Stage the file again and it should contain only the changes you consciously let in.