Here is what I did:
git checkout -b branch_name
.branch_name
.master
branch and did a fast-foward merge.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?
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
If in case any one faced when trying the following and got above error, here is the fix
Problem:-
#In master branch
git checkout -b feature-a
#changed to feature-a branch
vi a.txt
git commit -m "adding a file" a.txt
git push
git diff master
fatal: ambiguous argument 'master': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Solution:-
git diff origin/master
Normally, I work with diff's with something like this:
git diff -r 2e706c4dd3 -r 838112ed50 > codereview.txt
...to make a nice codereview.txt file. Well, I accidentally ran this:
git diff -r 2e706c4dd3 -r 838112ed50 > 838112ed50
This makes the file 838112ed50
itself, which, then, makes the git diff
command ambiguous, about whether I am trying to diff a file or a branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With