gitversion-control

Fatal: ambiguous argument '<branch_name>': both revision and filename


Here is what I did:

When I run git log branch_name --oneline, I get the following message:

fatal: ambiguous argument 'branch_name': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

What could be the problem?


Solution

  • It's telling you that you have a branch named 'branch_name' and also a file or a directory named 'branch_name'.

    If you want the command to treat 'branch_name' as a branch use

    git log --oneline branch_name --
    

    if you want it to treat 'branch_name' as a file use

    git log --oneline -- branch_name