Yes. By the mean value theorem, two functions that have the same derivative must differ by a constant:
Let h(x)= f(x)- g(x). f'(t)= g'(t), then h'(x)= 0 for all t. By the mean value theorem, h(b)- h(a)/(b- a)= 0 so h(b)- h(a)= 0 and h(b)- h(a)= 0. That is, h is a constant and so f and g differ by a constant.
Since f(t)= 5t has f'(x)= 5 for all t,any function with derivative always equal to 5 must be of the form g(x)= 5x+ C. In order that g(0)= -7, C must be -7.