Git - 获取他们创建的所有提交和斑点 [英] Git - get all commits and blobs they created

查看:116
本文介绍了Git - 获取他们创建的所有提交和斑点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可以为每次提交输出的git命令:


  1. id

  2. 主题

  3. 用它们的路径和大小创建的blob(像 git ls-tree -l -r ),但仅用于创建blob)


解决方案

获取提交(全部并输出每行提交一行) p>

  git rev-list --all --pretty = oneline 

然后用限制为2的空格分割提交并获取每个提交id和消息

获取由提交创建的blob (递归到子类,显示合并提交,检测重命名和副本,不要在第一行显示提交ID):

  git diff-tree -r -c -M -C -no-commit-id< commit-sha> 

对每行进行一些解析并排除其中的一部分 - 我们得到新的blob列表和他们的路径提交



最后是获取blob大小:

  git cat-file --batch-check< <列表的二进制大对象-SHA值> 

另一次解析


Is there a git command that can output for every commit:

  1. id
  2. subject
  3. blobs it created with they path and size (like git ls-tree -l -r <commit> but only for created blobs)

解决方案

To get commits (all and output one line per commit):

git rev-list --all --pretty=oneline

Then split commits by space with limit of 2 and get every commit id and message

To get blobs created by commit (recurse to subdirs, show merge commits, detect renames and copies, don't show commit id on first line):

git diff-tree -r -c -M -C --no-commit-id <commit-sha>

A bit of parsing of every line and excluding some of them — and we get list of new blobs and they path for commit

Last is to get blob sizes:

git cat-file --batch-check < <list-of-blob-shas>

And another time a bit of parsing

这篇关于Git - 获取他们创建的所有提交和斑点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆