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.
I would like to store source commit hash in git notes.
Is it possible? How?
-not -path ./.git\*as--tree-filteris run in a temporary directory that contains no.gitdirectory-not -name .gitignore -not -name .gitattributessince such files can occur at any subdirectory..gitmodulesshould only occur at the top level, so there-pathmakes sense. The problem with-path ./.git\*is that it won't recognizesubdir/.gitignore, for instance, because that isn't path./.git*, but rather path./subdir/.git*.