26 lines
1.1 KiB
Bash
Executable File
26 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# List all branches that start with "dev" and check out each branch into a separate directory
|
|
for branch in $(git branch -r | grep "origin/dev" | sed "s|origin/||"); do
|
|
# Create a new directory for each branch
|
|
mkdir "../${branch}"
|
|
# Check out the branch into the newly created directory
|
|
git worktree add "../${branch}" $branch
|
|
done
|
|
|
|
# List all branches that start with "preprod" and check out each branch into a separate directory
|
|
for branch in $(git branch -r | grep "origin/preprod" | sed "s|origin/||"); do
|
|
# Create a new directory for each branch
|
|
mkdir "../${branch}"
|
|
# Check out the branch into the newly created directory
|
|
git worktree add "../${branch}" $branch
|
|
done
|
|
|
|
# List all branches that start with "master" and check out each branch into a separate directory
|
|
for branch in $(git branch -r | grep 'origin/master' | grep -vE 'origin/(HEAD|master$)' | sed 's|origin/||'); do
|
|
# Create a new directory for each branch
|
|
mkdir "../${branch}"
|
|
# Check out the branch into the newly created directory
|
|
git worktree add "../${branch}" $branch
|
|
done
|