Skip to content

Commit

Permalink
Merge pull request #133 from felipealfonsog/development
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
felipealfonsog authored Dec 20, 2024
2 parents eb82b06 + 205a1ea commit 26ae7aa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions auto_list_branches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Automatically detect the base directory from where the script is executed
base_dir=$(pwd)

echo "Searching for repositories in the base directory: $base_dir"

# Function to list branches of a Git repository
list_branches() {
local repo_path="$1"
echo "=== Branches in $repo_path ==="
cd "$repo_path" || return
git branch -a
echo ""
}

# Automatically find Git repositories and list branches
find "$base_dir" -type d -name ".git" | while read -r git_dir; do
repo_path=$(dirname "$git_dir") # Get the repository path
list_branches "$repo_path"
done

0 comments on commit 26ae7aa

Please sign in to comment.