Reputation: 31253
Context: I am making a tool to analyze differences between 2 branches. I would like to watch the history of commits on origin/develop
and origin/release
. As I need the history only, I cloned the project with only the history (git clone --bare
)
After a git fetch
, I would like to see the latest commits on release and develop without having to git merge origin/develop|release
on each branch. So I tried to just git log origin/develop [... format options]
.
On some projects, it works as expected. But on a particular project, I get this error :
$ git log origin/develop master * ] 11:01
fatal: ambiguous argument 'origin/develop': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
If I try git remote -v
, I can see that origin
is correctly defined. How could origin/develop
not be a valid revision?
Upvotes: 5
Views: 1765
Reputation: 311978
To quote the documentation of the --bare
flag:
Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to
refs/remotes/origin
This git log
option would work if the repository was cloned without the --bare
flag.
EDIT:
To answer the question in the comments, this also means you can call git log <branchname>
directly, without referring to origin/<branchname>
. I.e., in your case:
git log develop
Upvotes: 1