Knowledge Base > Cover CLI > Creating a patch file
Creating a patch file
Some Diffblue Cover commands take 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)
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
)
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
)
git fetch REMOTE
git diff REMOTE/TARGET_BRANCH...HEAD > $DIFFBLUE_PATCH
For a patch containing only currently uncommitted changes
git diff > $DIFFBLUE_PATCH