Hi,
Something like this?
-- snip --
#!/bin/sh
TARFILE="$1"
test -z "$TARFILE" && TARFILE=-
git-ls-files -z | xargs -0 rm
tar xvf "$TARFILE" | xargs git add
git-update-index --remove $(git-ls-files)
-- snap --
Notes:
- this updates the index to match the given tarfile, you still
have to commit yourself
- it does not handle compressed tarfiles (you have to do something
like "cat bla.tar.gz | gzip -d | sh git-untar.sh")
- it does not remove empty directories (i.e. if the current index
contains a file "a/b", and the tarfile does not, and the
directory "a" is now empty, this is not handled)
- usually, tarfiles contain files inside a subdirectory. There is
no facility to strip the subdirectory
Hth,
Dscho
-