1
0

More than 1 year has passed since last update.

fatal: ambiguous argument 'branch_name': both revision and filenameの解決方

Posted at

ブランチを操作しようとしたときにでたエラー

fatal: ambiguous argument 'branch_name': both revision and filename
Use '--' to separate paths from revisions, like this:

「branch_name」という名前のブランチと、「branch_name」という名前のファイルまたはディレクトリがあることを示しています。

コマンドで「branch_name」をブランチとして扱いたい場合は、
git log --oneline branch_name --
「branch_name」をファイルとして扱いたい場合は、
git log --oneline -- branch_name

ブランチ名とファイル/ディレクトリが同じだと今後もトラブルが出そうなのでブランチ名を変更することにしました。
ローカルのブランチ名を変更する方法
git branch -m <古いブランチ名> <新しいブランチ名>
今開いているブランチをリネームする場合は、単純に新しいブランチ名を指定するだけです。
git branch -m <新しいブランチ名>

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0