---
title: GIT: Fatal Ambiguous Argument, Branch and Filename
description: While rare, you might run into an error when using Git version control that your branch name and a filename are the same.
date: 2021-03-26
tags: Git, Error
source: https://brianchildress.co/blog/git-fatal-ambiguous-argument-both-branch-and-filename
---

# GIT: Fatal Ambiguous Argument, Branch and Filename

While rare, you might run into an error when using Git version control that your branch name and a filename are the same. The error happens when you attempt to run a git command using the conflicting name.

_Error:_
> fatal: ambiguous argument 'branch_name': both revision and filename

As an example, we'll try to run the `git log` command. We receive an error when we have a branch named _branch\_name_ AND a file named _branch\_name_ (why would you do that 🤔).

To treat _branch\_name_ as a branch:

```sh
git log --oneline branch_name --
```

To treat the _branch\_name_ as a file:

```sh
git log --oneline -- branch_name
```

Credit to this [StackOverflow poster](https://stackoverflow.com/a/26349250).
