Generalized linear models (GLMs) are used within a vast number of application domains. However, formal goodness of fit (GOF) tests for the overall fit of the model$-$so-called "global" tests$-$seem to be in wide use only for certain classes of GLMs. In this paper we develop and apply a new global goodness-of-fit test, similar to the well-known and commonly used Hosmer-Lemeshow (HL) test, that can be used with a wide variety of GLMs. The test statistic is a variant of the HL test statistic, but we rigorously derive an asymptotically correct sampling distribution of the test statistic using methods of Stute and Zhu (2002). Our new test is relatively straightforward to implement and interpret. We demonstrate the test on a real data set, and compare the performance of our new test with other global GOF tests for GLMs, finding that our test provides competitive or comparable power in various simulation settings. Our test also avoids the use of kernel-based estimators, used in various GOF tests for regression, thereby avoiding the issues of bandwidth selection and the curse of dimensionality. Since the asymptotic sampling distribution is known, a bootstrap procedure for the calculation of a p-value is also not necessary, and we therefore find that performing our test is computationally efficient.