按提交者列出远程分支&修改数据

时间:2016-01-09 16:51:13

标签: git

我可以用

git ls-remote

列出我的远程存储库(documentation)上的分支。如果有很多很多,我怎么知道哪些对于获取有用?我想象的那种命令对于这样的任务是有用的

  1. 以反向日期时间记录远程存储库上的所有提交 命令显示他们所在的分支;或
  2. 列出远程存储库中包含对a的更改的所有分支 具体文件
  3. 我找不到这些命令中的任何一个。 git中有哪些命令行工具可以帮助确定git ls-remote列出的哪些分支可能有用?

1 个答案:

答案 0 :(得分:1)

由您决定要获取哪些分支,您必须知道您的项目以及包含哪些分支,

如果您想按照我要求提供的方式使用它来打印您要求的内容。

打印具有最后修改日期+最后一个提交者

的分支列表
# update local repository to get all the remote branches & tags    
git fetch --all --prune

# list all the branches from the remote and process them one at a time
for ref in $(git branch -r ); 
do 
    # print the last log message of the given branch
    git log -n1 $ref 

    # print out (in colors) the the data, using log format varaibles
    --pretty=format:"%Cgreen%an%Creset %C(yellow)%d%Creset %C(bold blue)%cr%Creset%n" ;

    # end of loop, print + sort by commiter & date 
    done | cat | sort -n -k1,1
相关问题