Make delicious recipes!

Git operators



.. operator


  1. git log branch1..branch2 (shows logs from commits present in branch2 but not in branch1)
  2. git log origin/master..HEAD (shows what you are about to push to origin/master from HEAD)



~ and ^ operator


Covered in git show



--not operator and ^ operator used as negation


^ operator can also be used as a negation operator in which case it becomes equivalent to the --not operator.
For example: the following commands are same:
  1. git log branch1..branch2
  2. git log ^branch1 branch2
  3. git log branch2 --not branch1

This becomes useful when operating on multiple branches.
For example: the following commands are same:
  1. git log branch1 branch2 ^branch3
  2. git log branch2 branch2 --not branch3



... operator


git log branch1...branch2 will show commits present in branch1 OR branch2 but not in both.
It can be combined with --left-right operator to show which commit belongs to which branch.
git log --left--right branch1...branch2





Like us on Facebook to remain in touch
with the latest in technology and tutorials!


Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Name:
Email: (Your email is not shared with anybody)
Comment:

Facebook comments:

Site Owner: Sachin Goyal