# Patch files

Cover Optimize uses a patch file. The exact patch file you need depends on your setup, but here are some examples using `git diff`. The variable `DIFFBLUE_PATCH` represents the name of your patch file.

***

For a patch containing commits newer than the project's origin (i.e. the corresponding branch on the remote repository your local branch was created from):

```groovy
git diff $(git rev-parse --abbrev-ref HEAD)...HEAD > $DIFFBLUE_PATCH
```

***

For a patch containing commits on your branch newer than those on the local copy of `TARGET_BRANCH` (e.g. where `TARGET_BRANCH` is `develop`):

```groovy
git diff TARGET_BRANCH...HEAD > $DIFFBLUE_PATCH
```

***

For a patch containing commits on your branch newer than those on the remote host `TARGET_BRANCH` (e.g. where `REMOTE` is `origin` and `REMOTE/TARGET_BRANCH` is `origin/develop`):

```groovy
git fetch REMOTE
git diff REMOTE/TARGET_BRANCH...HEAD > $DIFFBLUE_PATCH
```

***

For a patch containing only currently uncommitted changes:

```groovy
git diff > $DIFFBLUE_PATCH
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cover-docs-preview.diffblue.com/features/cover-optimize/patch-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
