The incident happened outside the Black Bull pub on Lockerbie's Station Road at about 22:25 on Saturday.
A 26-year-old man who was in the beer garden was approached by two men and an "altercation" ensued.
The victim was knocked to the ground by one of the men and the pair then made their way from the scene towards the High Street.
The man had been knocked unconscious and was taken to Dumfries Infirmary for treatment to cuts to his face.
PC Mike Briody said: "This was a nasty assault and could have resulted in the victim being very seriously injured as he was unconscious after the attack.
"As it was he required hospital treatment and received stitches as a result."
The men police are trying to trace have been described as:
Police said CCTV had shown a number of people in the area at the time and asked them to come forward.
A man was left in hospital after being knocked unconscious in a south of Scotland beer garden.