有意思,高质量和自己目前学习工作密切相关的开源项目的集合
git的使用技巧:
开发过程中会经常用到的git的小技巧,链接传送门:
https://github.com/git-tips/tips
git-standup
链接:https://github.com/kamranahmedse/git-standup
git-standup
回顾你上一个工作日做了什么,或者好奇其他的人做了什么
Install
你可以使用curl来安装它
$ curl -L https://raw.githubusercontent.com/kamranahmedse/git-standup/master/installer.sh | sudo sh
或者使用npm
进行安装
$ npm install -g git-standup
或者从github克隆后手动地安装它
$ git clone https://github.com/kamranahmedse/git-standup.git
$ cd git-standup
$ sudo make install
Mac 用户可以使用 brew
进行安装
$ brew update
$ brew install git-standup
Arch 用户可以在AUR中找到package
$ pacaur -S git-standup-git
用法
$ git standup [-a ]
[-w ]
[-m ]
[-f]
[-L]
[-d ]
[-D ]
[-g]
[-h]
下面是每个参数的具体描述
-
-a
- 指定作者将搜索限制为姓名或者邮箱 -
-w
- 指定星期范围的搜索(例如git standup -w SUN-THU`) -
-m
- 指定递归目录搜索的深度 -
-L
- Toggle inclusion of symbolic links in recursive directory search -
-d
- 指定返回包括的天数 -
-D
- 指定“gitlog"的日期格式(默认: relative) -
-h
- 显示帮助界面 -
-g
- 显示提交是否为GPG签名 -
-f
- 预先fetch最新的提交
基本的用法,你只需要在你的仓库或者包含多个仓库的文件夹中运行git standup
就可以。
单个仓库的用法
检查自上次工作日来你个人的所有提交,指向项目仓库并运行
$ git standup
包含多个仓库的用法
打开多个仓库所在的目录下并运行
$ git standup
This will show you all your commits since the last working day in all the repositories inside.
接下来就会显示你从上一个工作日以来该目录下仓库的所有代码提交
目录深度
默认情况下脚本只会搜索当前的目录或者下一级目录,如果你想搜索更深的目录,可以使用-m
进行切换
$ git standup -m 3
目录白名单
If you want to restrict the standup to some paths, you can whitelist them by adding them to a .git-standup-whitelist
file. For example if you have the below directory structure
如果你想限制standup到某些路径,你可以把他们加到一个 git-standup-whitelist
文件的白名单中,例如你的目录结构如下:
├── Workspace # 你所有的仓库在这
│ ├── project-a # 名称为project-a的git 仓库
│ ├── project-b # 名称为project-b的git仓库
│ ├── sketch-files # 一些草图文件
│ ├── mockups # 一些模拟文件
│ └── ... # etc.
└── ...
如果你想使用git-standup
仅显示project-a
和 project-b
的log ,你可以在workspace根目录下创建一个内容为如下的.git-standup-whitelist
文件,那么standup就会只把这些目录放到自己的执行范围内。
project-a
project-b
查看其他人的提交
如果你想查看其他人的提交,你可以执行:
# Considering their name on git is "John Doe"
$ git standup -a "John Doe"
查看每一个提交者都做了什么
如果你想查看每个人都提交了那些内容,你可以执行:
$ git standup -a "all"
如果你想查看n
天前的提交
If you would like to show all your/someone else's commits from n days ago, you can do
如果你想显示从 n 天前来你或者其他人的全部提交,你可以执行:
# 显示从4天前我的所有提交
$ git standup -d 4
# 显示5天前来“John Doe”的所有提交
$ git standup -a "John Doe" -d 5
Identifying Signed Commits
添加-g
标志检查GPG信息
$ git standup -g
指定日期格式
添加-D
标志指定日期格式,默认为relative
Please note that it accepts the same format that you could pass while doing git log. For example
$ git standup -D relative
# Or instead of relative, it could be local|default|iso|iso-strict|rfc|short|raw etc
Changing the Weekdays
By default, it considers that the work week starts on Monday and ends on Friday. So if you are running this on any day between Tuesday and Friday, it will show you your commits from the last day. However, if you are running this on Monday, it will show you all your commits since Friday.
If you want to change this, like I want because here in Dubai working days are normally Sunday to Thursday, you will have to do the following
$ git standup -w "SUN-THU"
Fetch commits before showing standup
If you have many repositories that you want to generate a standup for, it may be useful to automatically run git fetch
before viewing the standup.
If you would like to automatically run git fetch --all
before printing the standup, you can add the -f
flag, as show below
$ git standup -f
Mixing options
Of course you can mix the options together but please note that if you provide the number of days, it will override the weekdays configuration (MON-FRI
) and will show you the commits specifically from n
days ago.
# Show all the John Doe's commits from 5 days ago
$ git standup -a "John Doe" -d 5
Motivation
We have daily standup meetings at our workplace and I was used to checking the heat map on my Github profile or running git log (one by one in each of the projects) to note what I did and it seemed to be a bit cumbersome. To automate it, I searched and came across some of the aliases and snippets that people had been using but none of them directly served my purpose and so I spent a little time over the weekend to write this utility.
License
MIT © Kamran Ahmed