maf
maf

Reputation: 333

How can I interactively assign chunks (diff hunks) to a set of new commits?

Sometimes, after I have made multiple changes to multiple files, I want to split them into a set of new commits. I know about the --patch option to git add and git's interactive mode. But as far as I can tell, those force me to step through all chunks, decide whether I want to stage them or not, and then commit the staged chunks. That procedure I have to repeat for every new commit. Therefor, I have to look at some of the chunks multiple times until I have finally reached the proper commit.

Is there a command or tool that would allow me to step through all changes only once, assign each to a (growing) set of target commits, and finally make those commits?

Upvotes: 0

Views: 492

Answers (1)

torek
torek

Reputation: 487725

The short answer is no, there is no tool for this.

You're not the only one who wants it: see Multiple staging areas. A really good implementation is, however, extremely difficult. I have a not-fully-baked idea of a way to build a kind of half-assed (or at least, not-fully-assed) implementation, which I outlined in my answer to that question.

Upvotes: 1

Related Questions