Git:'git log --graph'和'git log --graph --all'有什么区别?

Git: What is the difference between 'git log --graph' and 'git log --graph --all'?

命令:git log --graph,在输出的左侧以基于文本的图形表示形式显示提交日志。

关于限制提交输出的选项--allgit doc说:

Commit Limiting

Besides specifying a range of commits that should be listed using the special notations explained in the description, additional commit limiting may be applied.

--all

Pretend as if all the refs in refs/ are listed on the command line as <commit>.

我不太了解使用此选项得到的输出。

的所有引用是什么refs/?

与提交限制相关的git log --graph的默认值是多少?

关于提交限制, git log --graphgit log --graph --all 有什么区别?

--all 将包括来自所有分支的提交,包括 refs/tagsrefs/remotes.

如果您只想要所有分支,则可以使用 --branches

git log --graph --all

* 456 (master)
|
* 123           * 789 (feature-1)
|  _____________|
| /
|/

git log --graph

* 456 (master)
|
* 123           

关于提交限制,这两个命令之间没有区别:如果不指定限制,将显示所有提交。

--all 选项可以让你看到所有本地分支(我添加了 --oneline 来作为一个较短的例子):

例如,在 master 上提交和两个功能分支(每个分支有一个提交):

$ git log --graph --oneline      
* 389c7c6 1st commit             // <- branch master

$ git log --graph --all --oneline 
* 03a21a0 feature2 stuff         // <- branch feature2
| * 2c848b3 feature1 stuff       // <- branch feature1
|/  
* 389c7c6 1st commit             // <- branch master

这与 git log --graph master feature1 feature2 相同:--all 选项为您添加所有本地分支和标签(.git/refs/ 中的引用)。

关于提交限制:没有限制,您将获得整个历史记录(可从当前分支访问)。