Skip to content

Commit af6677f

Browse files
committed
chore(scripts): Fix stash handling in bump_version.sh script
1 parent e95fe87 commit af6677f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

scripts/bump_version.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,15 @@ commit_push_and_create_pr() {
223223
git config pull.rebase false
224224
local branch_name="bump-$(basename $feature)"
225225
git show-ref --verify --quiet refs/heads/$branch_name
226+
git stash || { log_fatal "Failed to stash changes"; } # Stash changes before checking the branch
226227
if [ $? -eq 0 ]; then
227228
git checkout $branch_name
228-
git stash || { log_fatal "Failed to stash changes"; }
229229
git fetch origin $branch_name || { log_fatal "Failed to fetch changes"; }
230230
git reset --hard origin/$branch_name || { log_fatal "Failed to reset to remote branch"; }
231-
git pull origin $branch_name || { log_fatal "Failed to pull changes"; }
232-
git stash pop || { log_fatal "Failed to pop stash"; }
233231
else
234232
git checkout -b $branch_name
235233
fi
234+
git stash pop || { log_fatal "Failed to pop stash"; } # Pop the stash after updating or creating the branch
236235
git add "$version_file_path" || { log_fatal "Failed to add changes"; }
237236
git commit -m "$commit_message" || { log_fatal "Failed to commit changes"; }
238237
git push origin $branch_name || { log_fatal "Failed to push changes"; }

0 commit comments

Comments
 (0)