commit
d0960c6965
54
README.md
54
README.md
|
|
@ -2,6 +2,60 @@
|
|||
This Repo contains general standard modules for all projects.
|
||||
|
||||
|
||||
----
|
||||
|
||||
## If you want to install each branch in separate directory, use the below:
|
||||
|
||||
- First: clone the full repo, say you named it `complete-odex25-standard-modules-repo`
|
||||
- Second: `$cd complete-odex25-standard-modules-repo`
|
||||
- Then do the following:
|
||||
|
||||
> Each script will create a ceparate dir for each branch but outside `complete-odex25-standard-modules-repo`
|
||||
|
||||
- Inside the dir `complete-odex25-standard-modules-repo` , create a file named `checkout_branches.sh` and writes the script content into it:
|
||||
```sh
|
||||
#!/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
|
||||
```
|
||||
- Run the script by:
|
||||
```sh
|
||||
$./checkout_branches.sh
|
||||
```
|
||||
|
||||
> If you want to `Extract the directory name without 'dev_' prefix`
|
||||
> ```sh
|
||||
> 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
|
||||
> ```
|
||||
----
|
||||
|
||||
### Branches:
|
||||
- dev_odex-event
|
||||
- dev_odex25_accounting
|
||||
|
|
|
|||
Loading…
Reference in New Issue