1

I use git add -p all the time. For large hunks I often go into (e)dit mode to review and adjust the hunk as desired.

Is there a way to edit the FULL diff (every hunk in every file), rather than make staging decisions one hunk at a time?

I know you can (s)plit a large hunk into smaller ones. I'm looking for something that kind of does the opposite: combine small hunks into one large one.

2
  • 1
    Something like git diff >big.patch && vim big.patch && git apply big.patch && rm big.patch ? Commented Jul 22, 2020 at 19:45
  • @phd Wonderful! I didn't know about git apply. This is exactly what I'm looking for. Thank you. I love SO. Commented Jul 22, 2020 at 19:51

1 Answer 1

3

(Expanding from comment) Let's change the approach — use git diff + git apply instead of git add:

git diff >big.patch && vim big.patch && git apply big.patch && rm big.patch 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.