下一个命令是存储提交历史记录和文件列表,但删除文件内容,以便在需要了解大型 repo 的历史记录而不获取大型对象时最小化磁盘空间和网络流量消耗。这可以节省很多时间。
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
我还需要知道源提交哈希。如您所见,它被附加到提交消息中--msg-filter
。
我想将源提交哈希存储在git notes中。
是否可以?如何?