File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,18 +26,18 @@ jobs:
2626 run : |
2727 git fetch --all # Ensures all branches are fetched from origin
2828
29- # List of all remote branches excluding `main`
29+ # List all remote branches excluding `main`
3030 BRANCHES=$(git branch -r | grep -Eo "origin/[^/]+" | sed 's/origin\///' | grep -vE '^(main)$')
3131
3232 # Loop through each branch
3333 for branch in $BRANCHES; do
3434 echo "Merging main into $branch..."
3535
36- # Checkout the branch
37- git checkout $branch
36+ # Checkout the branch (ensuring we escape any special characters)
37+ git checkout " $branch"
3838
3939 # Pull the latest changes from the remote branch
40- git pull origin $branch --rebase # Using rebase to avoid merge commits
40+ git pull origin " $branch" --rebase # Using rebase to avoid merge commits
4141
4242 # Merge the main branch into the current branch
4343 git merge --no-edit origin/main || echo "No new changes to merge or merge conflict detected"
4949 fi
5050
5151 # Push the updated branch back to origin
52- git push origin $branch
52+ git push origin " $branch"
5353 done
You can’t perform that action at this time.
0 commit comments