For your german shepherd, it sound as if he want to play or otherwise interact with the 6 year old dog on the other side of the fence. While you cannot do much about the neighbor’s dog, there are a few ways to teach your dog that barking is not a wanted behavior.
First, I would recommend teaching or brushing up on the Leave It cue, which can be learned fairly easily. Having someone hold an object your dog wants, but that they are not allowed to have, you can give your dog the cue “Leave It” to teach them that ignoring anything you tell them to leave alone gets a reward.
A physical barrier like a row of bushes can help, but some dogs will still bark even if they hear others back. I would recommend going through a positive reinforcement dog training class, so that your dog sees you as the most fun and positive thing around, and will want to respond to you instead of barking and running.
Lastly, I would say giving your dog an alternative to barking, such as playing with a toy or giving them something else to focus on in the yard will help reduce the barking. I do not recommend using any shock and noise collars or devices, as they may cause your dog to become aggressive towards other dogs in a small space such as a yard.
I hope this information helps!