Skip to content

Commit

Permalink
Merge pull request #59 from siapy/feature-2
Browse files Browse the repository at this point in the history
refactor: Update branches script to improve branch management
  • Loading branch information
janezlapajne authored Jul 6, 2024
2 parents 6fec480 + b6c31ba commit 46bdddc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/update-branches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -e
set -x

# Save the current branch name
current_branch=$(git branch --show-current)

# Update main
git checkout main
git pull origin main

# Update develop
git checkout develop
git pull origin develop
git rebase main
git push

# Switch back to the original branch
git checkout "$current_branch"

# If the current branch is not main or develop, rebase it onto develop
if [[ "$current_branch" != "main" && "$current_branch" != "develop" ]]; then
git rebase develop
fi

echo "Branches have been updated and rebased accordingly."

0 comments on commit 46bdddc

Please sign in to comment.