Open phinze opened 13 years ago
If there are no commits, then the squash fails because rc
cannot find a previous commit from origin. I'm not sure how to handle this in an elegant way considering it will only happen once on new repos.
this will yield 0 on a new repo, and > 1 if there are commits:
git count-objects | awk '{print $1}'
it's existed in git since 2006 - so should be pretty reliably available
https://github.com/gitster/git/blob/c74320872b445104fe5c265e60785d9d26d94cc5/builtin-count.c
trying to
rc
a first commit of a new repo yields this error: