How to tie a knot

I know most people recommend no to use knots when joining yarn but I am going to knit a throw that has lots of color changes (a Kaffe Fasset) and have decided to use knots. My question is: How exactly do you tie a knot that will not come undone? I’ve had trouble finding info on this subject of knots in knitting. Thanks.

I tie a square knot (left end over right then right over left, or vice versa) and pull it really tight, then work the ends in as a go.

Thanks for the response. If I tie a square knot, do I have to weave in the ends? Will the knot be secure if I trim the ends leaving maybe half an inch (I do not care about neatness)?