threads / discuss / 15826

git-am: can't apply to an empty repository

Subject: git-am: can't apply to an empty repository

## tl;dr

One message between Oct 8, 2008 and Oct 8, 2008.

replies: 0people: 1as markdown or json

Imre Deak· Oct 8, 2008, 13:24 UTC · lore

When trying to build a repository from mbox format patches I have the following problem:

Creating a hypothetical mbox patch:
$ echo "From: imre deak <imre.deak@gmail.com>" > 1.patch
$ touch a
$ git diff --no-index /dev/null a >> 1.patch
$ cat 1.patch
From: imre deak <imre.deak@gmail.com>
diff --git a/a b/a
new file mode 100644
index 0000000..e69de29

Apply it to a newly created repository:

$ git init
Initialized empty Git repository in /home/imde/conv/git/.git/
$ git am 1.patch
fatal: HEAD: not a valid SHA1
fatal: bad revision 'HEAD'

Is this supposed to work at all?

--Imre

← back to recent threads