Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get-first-commit-log.sh
#!/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
You can’t perform that action at this time.