Go to the border and just stand somewhere nearby; cars will be moving slowly. Be careful not to hitchhike too close to the border as there are many Guardia Civil (police formed by Franco) and they are not really kind to hitchhikers.
Try hitching at Europa Point! There are many tourists who are at least driving you back to the city centre. We got lucky and got a hitch further to Tarifa with the first car we asked!
Do not forget to buy everything that you need in La Linea, because food is 2-4 times more expensive in Gibraltar than in La Linea. There is a lot of big supermarkets and some of them works 24 hours, for example Carrefour (Avenida de la Colonia).
Cigarettes, tobacco and strong alcohol is cheaper in Gibraltar than in other Sсhengen countries, because taxes is very small.