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 19, 2023
1 parent 07cf2f6 commit 2aeeb17
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .scripts/rebase_solutions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# FOR PROJECT MAINTAINERS ONLY

set -e
# Update branches
git checkout start-branch
git pull
git checkout solutions
# Rebase on solutions on start-branch
git rebase start-branch

# 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 2aeeb17

Please sign in to comment.