move duplicated get_local_heads() to remote.c