Next command is to store commit history and files lists but remove file contents in order to minimalize disk space and network traffic consumption when need to get know history of huge repo without fetching large objects. This allows to save much time.
git filter-branch -f -d `mktemp -d` \
--tree-filter '
find . -type f -not -path ./.git\* |
while read file; do > "$file"; done
' \
--msg-filter '
cat - && echo && echo "commit $GIT_COMMIT"
' \
-- metainfo/$BRANCH
I also need to know the source commit hash. It is appended to commit message as you can see in --msg-filter
part.
Is it possible? How?
Simple solution: do not change commit message, but create file.
git filter-branch -f -d `mktemp -d` \
--tree-filter '
find . -type f -not -path ./\*/.git\* |
while read file; do > "$file"; done
echo "$GIT_COMMIT" >.GIT_COMMIT
' \
-- metainfo/$BRANCH