> For the complete documentation index, see [llms.txt](https://cover-docs.diffblue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cover-docs.diffblue.com/features/cover-optimize/patch-files.md).

# 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
```
