Git log for range across all branches (even remote)
Asked Answered
W

2

20

I am trying the following

git log --before {2.days.ago} --after {14.days.ago} --all --stat

But it seems to only give me the log for one remote branch. I'd like to get the log for branches remote and local.

Willenewillet answered 29/1, 2013 at 17:51 Comment(0)
P
15
git log --before {2.days.ago} --after {14.days.ago} --all --stat --branches=* --remotes=*
Phytogenesis answered 29/1, 2013 at 18:29 Comment(4)
Thanks. --branches=* seems the only way to include all branches that are "out-of-line" or ahead with regard to the current HEAD.Brashy
Can you explain what --all, --branches=* and --remotes=* do, and whether the --all is redundant or not? I had a look at git-scm.com/docs/git-log but it's a little hard to read, and didn't give in the "EXAMPLES" section how to do a listing of commits that includes all commits from local and remotes, or even a single example of using --all.Delirious
Not 100% sure what it does, because I just built on the original asker's question, but from what I gather, it has to do with commits that may have been "lost" due to a git reset HEAD~1 or something like that, where the commit is only in the reflog, and not actually on a branch anymore.Phytogenesis
This answer is misleading, --all implies --branches=* and --remotes=*Rivulet
C
10

Can you explain what --all, --branches=* and --remotes=* do, and whether the --all is redundant or not?

--all, as mentioned in git rev-list or git rev-parse, --all include --branches or --remotes:

--all

Show all refs found in refs/.

--branches[=pattern]
--tags[=pattern]
--remotes[=pattern]

Show all branches, tags, or remote-tracking branches, respectively (i.e., refs found in refs/heads, refs/tags, or refs/remotes, respectively).

If a pattern is given, only refs matching the given shell glob are shown.
If the pattern does not contain a globbing character (?, *, or [), it is turned into a prefix match by appending /*.

See as an illustration t/t6018-rev-list-glob.sh#L136-L138:

test_expect_success 'rev-parse --exclude with --all' '
    compare rev-parse "--exclude=refs/remotes/* --all" "--branches --tags"
'

Since remote branches are requested, this should be enough:

git log --before {2.days.ago} --after {14.days.ago} --stat --branches --remotes
Chanukah answered 30/11, 2015 at 12:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.