Sometimes I need to split a big patch into smaller (disjoint) ones, e.g. for every separate feature included.

Usually I do it via standard vim yank/dd commands and split-window switching.

But are there some tools/vim-tricks to help with such kind of editing?

For example support for commands like: move the 3 next complete hunks to right opened patch file


4 Answers 4


You might want to take a look into patchutils [1]. For the vim part, I wrote a small vim plugin that helps with navigating in patches: diff_navigator [2].

[1] http://cyberelk.net/tim/software/patchutils/

[2] http://www.vim.org/scripts/script.php?script_id=2361

  • 1
    The diff_navigator URL is apparently vim.org/scripts/script.php?script_id=2361 Emacs has similar features in the Ediff and SMerge modes Commented Oct 1, 2010 at 9:59
  • 2
    Could you extend your answer to make it more comprehensive? Adding an example how to use what utility from the patchutils set to split a big patch into disjoint ones would be great ... Commented Aug 30, 2011 at 20:05

Somewhat off-topic, I guess but I still think it's useful.

If you use git to do your development you can easily split your whole changes into smaller "hunks" that embody one feature each. You end up with one commit per feature and can use git's git-format-patch to create (and even sign and properly attribute) patches, I outlined how to do that here


My Suse has splitdiff util which works like this:

$ splitdiff -a tmp.179639.patch
Wrote >tmp.179639.patch.part001
Wrote >tmp.179639.patch.part002

You can use this to split the big patch to smaller chunks (either per file or every hunk) and then if you need to merge then use combinediff from the patchutils package that was mentioned in Petr Uzel's answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .