1

I have two branch and two file have same name,like

branch:  
  branch_1  
  branch_2  

file:  
  branch_1  
  branch_2

Now I want use command

git log branch_1 --not branch_2

See the commit in branch_1 but not in branch_2, I find I can't find a solution get the right result.
I know I can use '--' tell git 'branch_1' is a branch not a file like

git log --oneline branch_1 -- --not branch_2 --

but I still don't get the right result, I even don't know what the output is.

I also know

git log --oneline branch_2..branch_1

give what I want. But I curiously. Is

git log branch_1 --not branch_2

can't treat situation like this? Or is a solution I don't know?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Lee Li
  • 392
  • 2
  • 5
  • 11

1 Answers1

3

git log branch_1 --not branch_2 -- should work.

Your example (which didn't work) was:

git log --oneline branch_1 -- --not branch_2 --
                           ^^
                          wrong

It should have been:

git log --oneline branch_1 --not branch_2 --

When you use only one '--' at the end, you signal git that whatever follow is a file.
See more about the double-hyphen convention.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250