#!/bin/bash # Output file to store the results output_file="grep_results.txt" # Initialize or clear the output file > $output_file # Get the list of remote branches git fetch --all branches=$(git ls-remote --heads origin | awk -F/ '{for(i=3; i<=NF; i++) printf "%s%s", $i, (i> $output_file fi fi done # Switch back to the original branch git checkout - # Display the results cat $output_file # Clean up the output file rm $output_file