Files
OldThink/upstream_merge_tool.sh
Cinka f02cc9cb87
Some checks failed
Build & Test Map Renderer / build (ubuntu-latest) (push) Has been cancelled
Build & Test Debug / build (ubuntu-latest) (push) Has been cancelled
Check Merge Conflicts / Label (push) Has been cancelled
Test Packaging / Test Packaging (push) Has been cancelled
RGA schema validator / YAML RGA schema validator (push) Has been cancelled
Map file schema validator / YAML map schema validator (push) Has been cancelled
YAML Linter / YAML Linter (push) Has been cancelled
Build & Test Map Renderer / Build & Test Debug (push) Has been cancelled
Build & Test Debug / Build & Test Debug (push) Has been cancelled
Benchmarks / Run Benchmarks (push) Has been cancelled
Update Contrib and Patreons in credits / get_credits (push) Has been cancelled
Build & Publish Docfx / docfx (push) Has been cancelled
- fix: engine update fix
2026-02-01 14:47:44 +03:00

70 lines
2.6 KiB
Bash

#!/bin/bash
echo "Moony's upstream merge workflow tool."
echo "This tool can be stopped at any time, i.e. to finish a merge or resolve conflicts. Simply rerun the tool after having resolved the merge with normal git CLI."
echo "Pay attention to any output from git! DO NOT RUN THIS ON A WORKING TREE WITH UNCOMMITTED FILES OF ANY KIND."
read -p "Enter the branch you're syncing toward (typically upstream/master or similar): " target
refs=$(git log --reverse --format=format:%H HEAD.."$target")
git config user.email "92106367+melanoTurbo@users.noreply.github.com"
git config user.name "melano"
options=("Cherry-pick" "Merge" "Skip")
g
for unmerged in $refs; do
summary=$(git show --format=format:%s "$unmerged")
if [ "$summary" == "automatic changelog update" ]; then
echo "Deliberately skipping changelog bot commit $unmerged."
echo "== GIT (CONFLICTS ARE OKAY) =="
git merge --no-ff --no-commit --no-verify "$unmerged"
# DELIBERATELY IGNORE merge conflict markers. We're just going to undo the commit!
git add .
git commit -m "squash! Merge tool skipping '$unmerged'"
newhead=$(git log -n 1 --format=format:%H)
git reset HEAD~ --hard
git reset "$newhead" --soft
git commit --amend --no-edit
echo "== DONE =="
continue
fi
git show --format=full --summary "$unmerged"
PS3="Commit action? "
select option in "${options[@]}"; do
case $REPLY in
1)
echo "== GIT =="
git cherry-pick "$unmerged"
echo "== DONE =="
break
;;
2)
echo "== GIT =="
git merge --no-ff -m "squash! Merge tool integrating '$unmerged'" "$unmerged"
echo "== DONE =="
break
;;
3)
echo "Skipping $unmerged"
echo "== GIT (CONFLICTS ARE OKAY) =="
git merge --no-ff --no-commit --no-verify "$unmerged"
# DELIBERATELY IGNORE merge conflict markers. We're just going to undo the commit!
git add .
git commit -m "squash! Merge tool skipping '$unmerged'"
newhead=$(git log -n 1 --format=format:%H)
git reset HEAD~ --hard
git reset "$newhead" --soft
git commit --amend --no-edit
echo "== DONE =="
break
;;
*)
echo "Invalid option, please select a valid option."
;;
esac
done
done