I guess you somehow need to get the branch of the submitter in the /apps/erpnext/.git/config file? and then do a switch-to-branch, or so?
I think I bumped over some instructions here on the forum (@snv was that a post of yours?) a while ago but unfortunately did not bookmark that post, so I can not find them now once again. Can someone help me out here?