Last active
August 29, 2015 14:27
-
-
Save matt-snider/a791b8bdbc0dbf593fbb to your computer and use it in GitHub Desktop.
Show the last n git commits in single-line format
This file contains hidden or 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 | |
# git-last | |
# | |
# Shows the last n commits in one line format. | |
# | |
# msnider$ git last 2 | |
# msnider$ 5c95c39 Refactor foo() | |
# msnider$ 9875103 Bump version to 1.3 | |
re='^[0-9]+$' | |
if ! [[ $1 =~ $re ]] ; then | |
echo "error: argument to git-last must be a number" >&2; exit 1 | |
else | |
git log --oneline --max-count=$1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment