Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #133

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Updates
  • Loading branch information
felipealfonsog committed Dec 20, 2024
commit 205a1eae1d448d1841054aab0e0a2b3d62ed6347
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