Hello, trying to factorise:

x^2-5x-6

So far i've got:

AC = -6, so x^2+x-6x-6 = x(x+1)-6(x+1)

Now getting to that point all makes sense to me, however in my textbook it says 'x+1 is a factor of both terms, so take that outside the bracket', leaving the answer as (x+1)(x-6). I don't understand how they got from x(x+1)-6(x+1) to (x+1)(x-6). Any help would be appreciated, thanks.