Git log-branches with a prefix

I want to log all changes in a specific set of branches to see the relationship between them, and I found that:

git log --graph --oneline --topo-order --decorate --simplify-by-decoration `git branch --list -a origin/foo/*`

does exactly what I want (i.e. the log changes on all branches that are prefix with foo / *).

But now I'm interested in learning the --branchesgit log option . This seems to work in a similar way, but if I use --branches=origin/foo/*either --branches=remotes/origin/foo*or even the --branches=foooutput will be very different (only very few and irrelevant commits are displayed).

The documentation says:

--branches[=<pattern>]
Pretend as if all the refs in refs/heads are listed on the command line as
<commit>. If <pattern> is given, limit branches to ones matching given shell
glob. If pattern lacks ?, *, or [, /* at the end is implied.

What is the difference? My problem has already been solved, since I can use the first version, but I ask about it, as I am curious. (And also adding a git alias is a little easier if you can use reverse ticks.)

- .

+4
1

, " git, ". .

--branches , "refs refs/heads". refs/heads, refs/remotes. - "origin/foo/*" . , git log , HEAD.

--remotes, --branches, refs/remotes. , :

git log --graph --oneline --topo-order --decorate --simplify-by-decoration --remotes='origin/foo/*'

--glob, , heads/ remotes/ . :

git log --graph --oneline --topo-order --decorate --simplify-by-decoration --glob='refs/*/foo/*'

, git branch, , . , . , , , HEAD. :

git log --graph --oneline --topo-order --decorate --simplify-by-decoration $(git branch --list -a 'origin/*')

, , -> . - git branch:

remotes/origin/HEAD -> origin/master
remotes/origin/master

, git for-each-ref ( ), :

git log --graph --oneline --topo-order --decorate --simplify-by-decoration $(git for-each-ref --format='%(refname)' 'refs/remotes/origin/*')
+7

All Articles