How to lane against Gnar as a melee champion?
Solution 1:
You need to dodge his boomerang as much as you can. It is slow moving and not hard to do. If you do get hit by one, immediately back off so that he can't get 2 autos off and proc his W on you.
One of your biggest problems, might be the fact that you were Xin top and Udyr jungle. Both are extremely linear champions and honestly cannot touch gnar. He can kite both to oblivion and and it's near impossible for them to get a successful stun off on him.
If you are Xin, you really sort of need to build tanky so that you can stay relevant throughout the whole game. There will never be a point that you are more useful than a good Gnar though. Gnar naturally does far more damage while building tanky and in mega form has a lot more CC.
Don't pick Xin into Gnar. Heck, don't even pick Xin without knowing who your lane opponent is because extremely linear champions are easily countered. If you want to beat Gnar as a melee, you need to play a champion who has really high damage and multiple gap closers. This means if you are really good with Irelia, you can double gap close her. Fiora works well since her double gap closer is easy. So does yasuo. The only other melee champion with a chance is Mao, but that's simply because he can easily sustain while using mana to farm.
TL;DR; Don't pick Xin into Gnar. Pick a melee that has a double gap closer and high damage.
Solution 2:
As a Gnar main, I know his strengths and weaknesses. Gnar's strongest point is where he can kite; picking Xin is just a free win for Gnar. Tanks and low-mobile Bruisers are also free wins for Gnar. Picking some hard ad champions is also really good for Gnar. Gnar's main weakness is that his low squishyness(?) makes the following champions good against gnar:
Renekton, for me, is a really hard matchup to stop a Gnar, because he can double E me and combo. My E has a longer cooldown so he can do it constantly, while I can't even deal my combo.
Jax is good but I think this is more of a skill matchup.
Irelia, Riven, and Fiora are better picks than Mao, Malp and Tanks, but, again, it's a skill-matchup .
During lane phase, make fast and burst trade with Gnar. With fast trade, he can't even deal real damage, picking an early damage burst champion is the key to win Gnar.