From 37a991d9e03893fc9da96440ccb1cdb5cce5f233 Mon Sep 17 00:00:00 2001 From: Matheus Albino Brunhara Date: Wed, 25 Oct 2023 09:40:54 -0300 Subject: [PATCH] Add file my-scripts/chatgpt/findStringInRepositoryBranches.sh --- .../chatgpt/findStringInRepositoryBranches.sh | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 my-scripts/chatgpt/findStringInRepositoryBranches.sh diff --git a/my-scripts/chatgpt/findStringInRepositoryBranches.sh b/my-scripts/chatgpt/findStringInRepositoryBranches.sh new file mode 100755 index 0000000..284bf27 --- /dev/null +++ b/my-scripts/chatgpt/findStringInRepositoryBranches.sh @@ -0,0 +1,30 @@ +#!/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