Fix error message on 'get commit' when there are no previous commits to show a log message from.

This commit is contained in:
William Hilton 2015-11-29 17:56:41 -05:00
parent 7298da2cc4
commit 5bbac7755a

View file

@ -115,7 +115,7 @@ fi
;;
'!' | commit)
echo "Parent commit: $(git log --abbrev-commit -1 --pretty=format:'%C(bold blue)%s%Creset %Cgreen(%cr)%Creset')"
parent_commit="$(git log --abbrev-commit -1 --pretty=format:'%C(bold blue)%s%Creset %Cgreen(%cr)%Creset' 2>/dev/null)" && echo "Parent commit: $parent_commit"
if [ -z "$2" ]; then
read -ep 'Message: ' msg
git commit -m "$msg"