Git operators
.. operator
- git log branch1..branch2 (shows logs from commits present in branch2 but not in branch1)
- 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:
- git log branch1..branch2
- git log ^branch1 branch2
- git log branch2 --not branch1
This becomes useful when operating on multiple branches.
For example: the following commands are same:
- git log branch1 branch2 ^branch3
- 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
Read full article from Git operators - PrismoSkills
No comments:
Post a Comment