When your squad is waiting for battle in a building and there are more than 5 squads in the queue (either attacker queue or defender queue), you can have your squad advance to an adjacent non-friendly building. Your squad will then leave the queue and march toward the target building.
When your squad is waiting for battle in a building and there are more than 5 squads in the queue, you can have your squad retreat to an adjacent friendly building. Your squad cannot retreat when there are no friendly buildings around the original building.