Home Explore Blog CI



git

3rd chunk of `Documentation/git-apply.adoc`
f0725c83fbfad4d1df8847f18b9e4af2931f4d7670a8248d0000000100000a13
 with this option, which would apply the
	deletion part but not the addition part.

--allow-binary-replacement::
--binary::
	Historically we did not allow binary patch application
	without an explicit permission from the user, and this
	flag was the way to do so.  Currently, we always allow binary
	patch application, so this is a no-op.

--exclude=<path-pattern>::
	Don't apply changes to files matching the given path pattern. This can
	be useful when importing patchsets, where you want to exclude certain
	files or directories.

--include=<path-pattern>::
	Apply changes to files matching the given path pattern. This can
	be useful when importing patchsets, where you want to include certain
	files or directories.
+
When `--exclude` and `--include` patterns are used, they are examined in the
order they appear on the command line, and the first match determines if a
patch to each path is used.  A patch to a path that does not match any
include/exclude pattern is used by default if there is no include pattern
on the command line, and ignored if there is any include pattern.

--ignore-space-change::
--ignore-whitespace::
	When applying a patch, ignore changes in whitespace in context
	lines if necessary.
	Context lines will preserve their whitespace, and they will not
	undergo whitespace fixing regardless of the value of the
	`--whitespace` option. New lines will still be fixed, though.

--whitespace=<action>::
	When applying a patch, detect a new or modified line that has
	whitespace errors.  What are considered whitespace errors is
	controlled by `core.whitespace` configuration.  By default,
	trailing whitespaces (including lines that solely consist of
	whitespaces) and a space character that is immediately followed
	by a tab character inside the initial indent of the line are
	considered whitespace errors.
+
By default, the command outputs warning messages but applies the patch.
When `git-apply` is used for statistics and not applying a
patch, it defaults to `nowarn`.
+
You can use different `<action>` values to control this
behavior:
+
* `nowarn` turns off the trailing whitespace warning.
* `warn` outputs warnings for a few such errors, but applies the
  patch as-is (default).
* `fix` outputs warnings for a few such errors, and applies the
  patch after fixing them (`strip` is a synonym -- the tool
  used to consider only trailing whitespace characters as errors, and the
  fix involved 'stripping' them, but modern Gits do more).
* `error` outputs warnings for a few such errors, and refuses
  to apply the patch.
* `error-all` is similar

Title: Git Apply Options
Summary
The --no-add option would apply the deletion part but not the addition part when using git apply. This option is useful for extracting the common part between two files by first running 'diff' on them and applying the result with this option, allowing for more control over the patch application process and enabling the user to selectively apply changes to their files.