2

I have a Git repository cloned from a remote repository. In my local repository, I see:

$ git branch --remotes
  origin/HEAD -> origin/master
  origin/master

But when I then do:

$ git log --remotes=origin/master

I get no output.

(git log origin/master does work, but I ultimately also want to use --exclude later, and it's unclear whether positional arguments are allowed to be interspersed with options. I'd prefer to be POSIX-ly correct.)

git log --help indicates:

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

which indicates to me that git log --remotes=origin/master is being treated as git log --remotes=origin/master/*, and that will always fail since .git/refs/remotes/origin/master is a file and not a directory.

So taking that into account, doing something like git log --remotes=origin/maste[r] does work, but that seems awkward and weird. Is there a better way?

3
  • You definitely can add options after ordinary refnames, git log master --not --tags shows you everything in the master history that isn't in a tagged history. Commented Jun 21 at 14:43
  • good catch, this glitch should be reported to the git mailing list Commented Jun 24 at 7:44
  • note that git log does work with interspersed options, as hinted in the documentation of options like --not or --exlucde. You can use -- to explicitly state "all bare words before that are ref names". Commented Jun 24 at 7:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.