2

I have staged some of the modified lines with git add --patch.

I have later modified those lines.

How could I stage the same lines without selecting them again with git add --patch?

Haralan Dobrev
  • 7,617
  • 2
  • 48
  • 66
  • i don't think `-p` is flexible enough to do this. you could cobble together a script that tries to do it with a three-way diff or something, but there's nothing built into git afaik. – Eevee May 25 '14 at 18:49

1 Answers1

1

This is not possible, and I don't think there is a straightforward way to script this that will be worth it. Suggest going through the git add -p process again.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • You are right about the script. I really thought `git-diff-index(1)` and `git-update-index(1)` would do the job. It seems they generate the patch internally and on the fly. There is no exposed API to get the staged lines from the patch. It would be really exhausting to write such a script. – Haralan Dobrev May 25 '14 at 19:06