I don’t think it works quite that way. The boar will still be charging at you, you’ll just be ‘charging’ backwards at the same speed for as long as you can hold on ;)
I read that when they used spears like this in the Middle Ages, the man would plant the butt of the shaft in or against the ground at an angle. Presumably someone else was driving the boars toward the spearmen.