Assuming you have a <workdir>
directory, that contains the unzipped contents of a repository export/tarball. That directory is called <repository export>
.
-
Enter the directory of the repository export
$ cd <workdir>/<repository export>
-
Initialize an empty git-repository on the export
$ git init Initialized empty Git repository in <workdir>/<repository export>/.git/ $ git add . $ git commit -m 'Initial commit of <repository export> on a new git history'
-
Assuming the patch is to be found in
~/Downloads/repo.patch
-
Apply the patch on the newly initialized git-repository
Note: If you are using
git-crypt
, you must ignore the.git-crypt
folder and its changes if the patch does not apply.$ git apply --binary --exclude=.git-crypt/* ~/Downloads/repo.patch $ git commit -m 'Applying changes since <repository export> on this git history'