由 git repo 產生 git graph
想要產生 git repo 內各分支與 commit 的圖形, 找到一個簡單的產生工具 git-big-picture
安裝程序
- 安裝環境 : Ubuntu 20.04
- Python >=3.7
- Git (1.7.1 works)
- Graphviz utility
- 安裝套件
sudo apt install git graphviz sudo pip install git-big-picture
使用方式
- 先將一個 git repo clone 下來 Exp. https://github.com/iii-org/devops-system
git clone https://github.com/iii-org/devops-system.git
- 看 git-big-picture 命令列參數
$ git-big-picture -h usage: git-big-picture OPTIONS [REPOSITORY] Visualize Git repositories positional arguments: REPOSITORY path to the Git working directory (default: current directory) optional arguments: -h, --help show this help message and exit --version show program's version number and exit --pstats FILE run cProfile profiler writing pstats output to FILE -d, --debug activate debug output output options: Options to control output and format -f FMT, --format FMT set output format [svg, png, ps, pdf, ...] --history-direction {downwards,leftwards,rightwards,upwards} enforce a specific direction of history on Graphviz (default: rightwards) --simplify remove edges implied by transitivity using Graphviz filter "tred" (default: do not remove implied edges) -g, --graphviz output lines suitable as input for dot/graphviz -G, --no-graphviz disable dot/graphviz output -p, --processed output the dot processed, binary data -P, --no-processed disable binary output -v CMD, --viewer CMD write image to tempfile and start specified viewer -V, --no-viewer disable starting viewer -o FILE, --outfile FILE write image to specified file -O, --no-outfile disable writing image to file -w SECONDS, --wait SECONDS wait for SECONDS seconds before deleting the temporary file that is opened using the viewer command (default: 2.0 seconds); this helps e.g. with viewer commands that tell other running processes to open that file on their behalf, to then shut themselves down filter options: Options to control commit/ref selection -a, --all include all commits -b, --branches show commits pointed to by branches -B, --no-branches do not show commits pointed to by branches -t, --tags show commits pointed to by tags -T, --no-tags do not show commits pointed to by tags -r, --roots show root commits -R, --no-roots do not show root commits -m, --merges include merge commits -M, --no-merges do not include merge commits -i, --bifurcations include bifurcation commits; a bifurcation commit is a commit that is a parent to more than one other commits, i.e. it marks the point where one or more new branches came to life; bifurcation commits can also be thought of as the counterpart of merge commits -I, --no-bifurcations do not include bifurcation commits -c, --commit-messages include commit messages on labels -C, --no-commit-messages do not include commit messages on labels git-big-picture is software libre, licensed under the GPL v3 or later license. Please report bugs at https://github.com/git-big-picture/git-big-picture/issues. Thank you!
- 產生簡單的 tag 分支圖(svg 格式)
git-big-picture --simplify -f svg -o our-project8.svg --history-direction upwards devops-system/
- 產生完整的 commit 分支圖(pdf 格式)
git-big-picture -a -f pdf -o our-project5.pdf --history-direction upwards devops-system/
下載看結果our-project5.pdf