📅  最后修改于: 2023-12-03 15:02:45.778000             🧑  作者: Mango
Git Distancees - Shell-Bash 是一款基于 Shell-Bash 编写的 Git 插件,用于计算 Git 仓库中两个不同分支之间的距离。这个距离由两个分支的最近公共祖先(LCA)到两个分支的提交表示。
Git Distancees - Shell-Bash 可以通过 git clone
命令下载:
git clone https://github.com/lister-louis/git-distancees.git
下载完成后,将 git-distancees
脚本添加到 PATH 环境变量中即可使用。
export PATH=$PATH:/path/to/git-distancees/
$ git distancees -h
Usage: git distancees [-h] [-s] [-l] [base branch] [compare branch]
Options:
-h, --help Show this help message and exit.
-s, --short Show short distancees.
-l, --long Show long distancees.
计算两个分支之间的距离:
$ git distancees feature-A develop
feature-A -> 03b650a
develop -> 8d9be10
Short Distance: 5
Long Distance: 8
LCA: 540a5a5
Commits in feature-A:
- 03b650a (1 days ago) feature-A: add new feature (#5)
- d0c069d (2 days ago) feature-A: fix an issue in new feature (#4)
- ad8cc4e (3 days ago) feature-A: improve performance (#3)
- acb05ed (4 days ago) feature-A: refactor code (#2)
- 7830716 (5 days ago) feature-A: initial implementation (#1)
Commits in develop:
- 8d9be10 (2 hours ago) develop: add new feature (#8)
- 540a5a5 (1 week ago) Merge branch 'feature-B' into develop
- 5c8c523 (2 weeks ago) feature-B: fix an issue in new feature (#7)
- 4d50a4c (3 weeks ago) feature-B: improve performance (#6)
- 3d3a6b3 (4 weeks ago) feature-B: refactor code (#5)
- 2456e26 (5 weeks ago) feature-B: initial implementation (#4)
- 2e7c293 (6 weeks ago) develop: remove old feature (#3)
- a958aa8 (7 weeks ago) develop: fix a bug (#2)
- 874f7b0 (8 weeks ago) develop: initial implementation (#1)
https://github.com/lister-louis/git-distancees
Git Distancees - Shell-Bash 是一款方便实用的 Git 插件,能够帮助我们快速计算 Git 仓库中两个不同分支之间的距离。GitHub 项目地址:https://github.com/lister-louis/git-distancees。