Is there a way to see which branches merged to test are not merged to main?

We inherited a messy repo, and a while ago I noticed some branches merged to the test branch that were not merged to main, and we let it go but now we’re having odd issues where the Test server is not behaving like the Prod server when all merge requests have been merged.

I’m having trouble finding how to even do this in git, but I’m sure GitLab has some way to show which branches are merged to one branch that aren’t on another branch…

Typically we merge our feature/fix branches to test, then once they pass QA, our branches are merged to main. We don’t merge test to main or vice-versa. It will just take me a while to compare all merged branches to each to see what’s different, until we’re allowed to reset test from main.

Hi @gilari

I’m sure there are much more sophisticated ways to do this, but if it were me, I’d just raise an MR from testmain and then close the MR when I’d got the information I needed.

If you need to do this repeatedly, then it might be worth writing a script which uses either raw Git or the GitLab API to spit out a list of commits, but if it’s just once I’m not sure it’s worth the hassle.

1 Like