widgets Git Patch Export and Import


For creating a patch from uncommitted changes:

git diff > backup.patch

Create a patch with new untracked files:

git diff --cached > backup.patch

–cached option the diff will compare the staged changes with the local repository.

With binary files (image, video, etc…) for patch:

git diff –cached –binary > backup.patch

Importing Patch

Apply a patch:

git apply backup.patch