From 372828b7b083e7aca4695f09610a2cb4fb2a66a5 Mon Sep 17 00:00:00 2001 From: Ahmad-Samir Date: Thu, 27 Jun 2024 04:35:03 +0300 Subject: [PATCH] Update README.md --- README.md | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index af1882119..5c4c18062 100644 --- a/README.md +++ b/README.md @@ -11,51 +11,11 @@ This Repo contains general standard modules for all projects. - 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 - ``` +- Run the script : `checkout_branches_full_names.sh` - Output will be like: `master_odex25_hr` - `preprod_odex25_hr` - `dev_odex25_hr` - ... -> 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 -> ``` +> If you want to `Extract the directory name without 'dev_' prefix`, use the script : `checkout_dev_branches_Extracted_names.sh` > - Output will be like: `odex25_hr` - ... ----