سؤال

Sometimes the hunks offered to you when you run git add --patch include unrelated changes mixed up with each other because the lines are physically close to each other in the file.

Is there a way to interactively add changes to the staging area on a line-by-line basis?

هل كانت مفيدة؟

المحلول

You can type e (for 'edit') when you are adding a specific patch with mixed content (too mixed for s or 'split' to work).

That allows you to delete the lines you don't want to add.

Then you can test what you have added with a git stash --keep-index, in order to see if that is working.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top