Skip to content

Commit

Permalink
chore: add script to rebase solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
guiyom-e committed Sep 12, 2023
1 parent a91e2b4 commit 55045cf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .scripts/rebase_solutions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# FOR PROJECT MAINTAINERS ONLY
# Update branches
git checkout start-branch || exit 1
git pull || exit 1
git checkout solutions || exit 1
# Rebase on solutions on start-branch
git rebase start-branch || exit 1

# Check number of commits
tags=("step2" "step3" "step4" "helpers" "step5" "step6" "step7" "step8" "step9" "step10" "step11" "_solution_")
number_of_commits=$(git log --oneline solutions ^start-branch | wc -l)
if [ "$commit_diff" -ne ${#tags[@]} ]; then
echo "The number of commits between start-branch and solutions is not correct, please update the branches or the script"
exit 2
fi

# Check tests pass
CI=true yarn test || exit 3

# Rebase interactively to re-apply tags
GIT_SEQUENCE_EDITOR="sed -i 's/^pick/edit/g'" git rebase -i start-branch

# Apply tags to commits
for tag in "${tags[@]}"
do
echo "Tagging $tag"
git tag -f $tag
git rebase --continue
done

echo ""
echo "================================================================="
echo "Rebase done, please push changes: "
echo "git push --force-with-lease && git push --force-with-lease --tags"
echo "You may allow force push on the repo settings "
echo "================================================================="

0 comments on commit 55045cf

Please sign in to comment.