How to iterate through all git branches using bash script

How can I iterate through all the local branches in my repository using bash script. I need to iterate and check is there any difference between the branch and some remote branches. Ex for branch ...