https://github.com/xiaoshihou514/git-biance
Visualize code contributions in a GitHub-style graph
https://github.com/xiaoshihou514/git-biance
git rust visualization
Last synced: 7 months ago
JSON representation
Visualize code contributions in a GitHub-style graph
- Host: GitHub
- URL: https://github.com/xiaoshihou514/git-biance
- Owner: xiaoshihou514
- License: gpl-3.0
- Created: 2025-02-03T19:38:28.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-22T05:52:02.000Z (7 months ago)
- Last Synced: 2025-05-01T20:03:24.031Z (7 months ago)
- Topics: git, rust, visualization
- Language: Rust
- Homepage:
- Size: 63.5 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README-zh.md
- License: LICENSE
Awesome Lists containing this project
README

git-鞭策是一个用rust写的,用来可视化队友干了多少活的小程序。
⚠️请*不要*用这个来压力同事,开开玩笑就得了⚠️
| `git biance --commits --plot` | `git biance --stat --plot` |
| :-----------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------: |
|  |  |
## 安装
### Fedora
```shell
sudo dnf install --nogpgcheck --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' terra-release
sudo dnf install git-biance
```
### 其他
```shell
cargo install git-biance
```
## 用法
```
Usage: git-biance [OPTIONS] [AUTHOR]
Arguments:
[AUTHOR] Specify certain author
Options:
-s, --stat Show total insertions and deletions
-c, --commits Show total commits
-p, --plot Visualize contributions with a graph
-f, --file ... Show insertions and deletions on single file
-h, --help Print help
-V, --version Print version
```
## 集成
### GitLab集成
用以下流程可以实现合并请求中自动鞭策的效果,需要成员添加名为CI_AUTOCOMMENTER_API_KEY的变量,值为个人授权码:
```yaml
# 别忘了把gitlab示例的链接改了
biance:
stage: deploy
variables:
GIT_DEPTH: 0
script:
- BIANCE_COMMIT=$(git biance -c | sed ':a; N; $!ba; s/ /%20/g; s/\n/%0A/g')
- BIANCE_STATS=$(find src/main/ -type f | xargs git biance -f | sed ':a; N; $!ba; s/ /%20/g; s/\n/%0A/g')
- BIANCE_MSG=$(echo "Beep%20boop%0A%0A$BIANCE_COMMIT%0A%0A$BIANCE_STATS")
- 'curl --request POST --header "PRIVATE-TOKEN: $CI_AUTOCOMMENTER_API_KEY" "https://your.gitlab.instance.com/api/v4/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes?body=$BIANCE_MSG"'
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
```

## 常见问题
> 有些人的名字出现了好几次是咋回事?
`git鞭策`用邮箱来区分用户,但是打印的是用户名。最可能的是你的队友没用ssh,所以每次推送邮件都不一样。你可以用[git mailmap](https://git-scm.com/docs/gitmailmap)来解决这个问题,运行以下命令获取所有推送过的人的用户名和邮件:
```shell
git log | grep Author | sort | uniq
```