Created
June 17, 2017 11:58
-
-
Save bradlucas/e9e4d9b8fe3682e1c293b1464db6b32f to your computer and use it in GitHub Desktop.
get-first-commit-log.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# @see http://stackoverflow.com/a/5189296 | |
# If the repo has no commits you'll get the following | |
# fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. | |
# Use '--' to separate paths from revisions, like this: | |
# 'git <command> [<revision>...] -- [<file>...]' | |
# | |
# Using 2> /dev/null to ignore these | |
git log $(git rev-list --max-parents=0 HEAD 2> /dev/null) 2> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment