下面的答案使用git log:
我在2009年用“ 无法在终端中显示Git树 ”提到了类似的方法:
git log --graph --pretty=oneline --abbrev-commit
但是我一直在使用的完整内容是在“ 如何使用git log --graph显示标签名称和分支名称 ”(2011)中:
git config --global alias.lgb "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative --branches"
git lgb
原始答案(2010年)
git show-branch --list 接近您要寻找的东西(与topo命令一起使用)
--topo-order
默认情况下,分支及其提交按相反的时间顺序显示。
此选项使它们按拓扑顺序显示(即,后代提交在其父之前显示)。
但是工具git wtf也可以提供帮助。例:
$ git wtf
Local branch: master
[ ] NOT in sync with remote (needs push)
- Add before-search hook, for shortcuts for custom search queries. [4430d1b] (edwardzyang@...; 7 days ago)
Remote branch: origin/master (git@gitorious.org:sup/mainline.git)
[x] in sync with local
Feature branches:
{ } origin/release-0.8.1 is NOT merged in (1 commit ahead)
- bump to 0.8.1 [dab43fb] (wmorgan-sup@...; 2 days ago)
[ ] labels-before-subj is NOT merged in (1 commit ahead)
- put labels before subject in thread index view [790b64d] (marka@...; 4 weeks ago)
{x} origin/enclosed-message-display-tweaks merged in
(x) experiment merged in (only locally)
NOTE: working directory contains modified files
git-wtf 显示给您:
- 如果是跟踪分支,则分支与远程回购的关系。
- 如果您的分支是功能分支,则它与非功能(“版本”)分支的关系。
- 如果是版本分支,则分支与功能分支的关系
git_tree。它将输出类似arc flow此处的内容:stackoverflow.com/questions/54227968/…。也许有一天我什至可以将其合并到git本身。