Adding a full directory through diff and patch

Is it possible to add a full directory through diff and patch?

It seems like a very convenient way to add additional modules on top of the standard code base.

I searched for some solutions, but they usually work at the file level, not at the directory level.

Thanks.

+4
source share
3 answers

Answering the question:

diff -urPp old_dir / new_dir / "> new_module.patch

This seems to be a trick.

+3
source

Two quick suggestions - they should help

  • You need the -r | --recursive flag -r | --recursive -r | --recursive

  • You probably also need --unidirectional-new-file or -N | --new-file -N | --new-file .

since I did what you mean here.

+2
source

Below actions will be performed

  • Running a patch between the old source code and the new source code (new files + new directories) diff -urPp old_src new_src> new.patch
  • create a temporary directory mkdir temp
  • copy the source old source directory to temp directory cp -r old_src temp
  • copy the patch file to the created temp directory cp new.patch temp
  • change directory cd temp
  • apply patch patch -p0 <new.patch

Now all patches will be applied with file changes + new files + adding a directory in the temp directory

0
source

All Articles