-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to rebase solutions
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" "solutions") | ||
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 "=================================================================" |