Create a tag tar
with file-others content to save.
$ git tag tar "$(tar cf - $(git ls-files -o --exclude-standard) | git hash-object -t blob -w --stdin --no-filters)"
Get back saved content from tag tar
:
$ git cat-file blob $(git show-ref -d -s refs/tags/tar || echo "missing") | tar tf -
Create or update a branch work
with file-others content to save in file work.tar
.
$ b="$(tar cf - $(git ls-files -o --exclude-standard) | git hash-object -t blob -w --stdin --no-filters)"
$ t="$(echo -n "100644 blob $b\twork.tar" | git mktree)"
$ p="$(git show-ref -d -s refs/heads/work || true)"
$ h="$(echo "work.tar commit" | git commit-tree ${p:+-p} ${p:+${p}} "$t")"
$ git update-ref refs/heads/work "$h"
Get back saved content from file work.tar
from branch work
:
$ git cat-file blob work:work.tar | tar tf -