adding checkout_branches scripts
This commit is contained in:
parent
52acf2d145
commit
281aeda22b
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/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
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/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
|
||||||
|
# Extract the directory name without 'dev_' prefix
|
||||||
|
dir_name=$(echo $branch | sed 's|^dev_||')
|
||||||
|
mkdir "../${dir_name}"
|
||||||
|
git worktree add "../${dir_name}" $branch
|
||||||
|
done
|
||||||
Loading…
Reference in New Issue