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.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
bcardarella
  • 4,667
  • 4
  • 29
  • 45

2 Answers2

15
git log --before {2.days.ago} --after {14.days.ago} --all --stat --branches=* --remotes=*
jakeonrails
  • 1,885
  • 15
  • 37
  • Thanks. --branches=* seems the only way to include all branches that are "out-of-line" or ahead with regard to the current HEAD. – A.Robert Jul 16 '15 at 06:18
  • 1
    Can you explain what `--all`, `--branches=*` and `--remotes=*` do, and whether the `--all` is redundant or not? I had a look at https://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`. – Andrew Grimm Nov 30 '15 at 00:33
  • 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. – jakeonrails Nov 30 '15 at 19:38
  • 1
    This answer is misleading, `--all` implies `--branches=*` and `--remotes=*` – CervEd Mar 22 '22 at 09:14
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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250