How to validate whether the commit with given sha exists in current branch?
There are many ways to parse outputs, but I need optimal way which returns boolean (for u
git cat-file prints information about the objects in the repository. "-e" checks if the object is valid and exits with a 0 status and when invalid exists with a 1.
git cat-file -e 3d68db1028afe27a0055c2234f98fc945b1958f5 echo $? 1