Skip to content

Commit 275e1c6

Browse files
committed
chore: add script to rebase solutions
1 parent a91e2b4 commit 275e1c6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.scripts/rebase_solutions.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
!#/bin/bash
2+
# FOR PROJECT MAINTAINERS ONLY
3+
# Update branches
4+
git checkout start-branch || exit 1
5+
git pull || exit 1
6+
git checkout solutions || exit 1
7+
# Rebase on solutions on start-branch
8+
git rebase start-branch || exit 1
9+
10+
# Check number of commits
11+
tags=("step2" "step3" "step4" "helpers" "step5" "step6" "step7" "step8" "step9" "step10" "step11" "solutions")
12+
number_of_commits=$(git log --oneline solutions ^start-branch | wc -l)
13+
if [ "$commit_diff" -ne ${#tags[@]} ]; then
14+
echo "The number of commits between start-branch and solutions is not correct, please update the branches or the script"
15+
exit 2
16+
fi
17+
18+
# Check tests pass
19+
CI=true yarn test || exit 3
20+
21+
# Rebase interactively to re-apply tags
22+
GIT_SEQUENCE_EDITOR="sed -i 's/^pick/edit/g'" git rebase -i start-branch
23+
24+
# Apply tags to commits
25+
for tag in "${tags[@]}"
26+
do
27+
echo "Tagging $tag"
28+
git tag -f $tag
29+
git rebase --continue
30+
done
31+
32+
echo ""
33+
echo "================================================================="
34+
echo "Rebase done, please push changes: "
35+
echo "git push --force-with-lease && git push --force-with-lease --tags"
36+
echo "You may allow force push on the repo settings "
37+
echo "================================================================="

0 commit comments

Comments
 (0)