gitversion-controlstaginggit-addgit-patch

See the full git add patch


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.


Solution

  • (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