1# Alternative 1 2git log --format="%H" -n 1 3 4# Alternative 2 5git rev-parse HEAD 6 7# Alternative 3 8git rev-parse origin/master Output: ea2104384crb8fb864f216530e45a70321ya80g7