From 8e68a8473c04ae99650ab19408589628ee583290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Rivera?= Date: Mon, 8 Jun 2026 16:04:04 +0200 Subject: [PATCH] ngcp pick: pull before cherry-picking --- ngcp.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ngcp.sh b/ngcp.sh index c18bb81..680ac8d 100755 --- a/ngcp.sh +++ b/ngcp.sh @@ -62,7 +62,19 @@ if [[ "$1" == "pick" ]]; then if ! git -C "$nixConfigPath" checkout "$remoteBranch"; then git -C "$nixConfigPath" checkout -b "$remoteBranch" "origin/$remoteBranch" fi - + echo "Pulling latest commits before cherry-picking..." + if ! git -C "$nixConfigPath" pull --rebase ; then + echo "Merge conflict detected during pull." + echo "Resolve conflicts and run:" + echo " git rebase --continue" + echo "Type 'y' when done." + + while git -C "$nixConfigPath" rev-parse --verify REBASE_HEAD >/dev/null 2>&1; do + read -r answer + [[ "$answer" == "y" ]] || continue + done + echo "Pull successful" + fi for commit in "${@:2}"; do if ! [[ $commit =~ --.* ]]; then # if not a flag if git -C "$nixConfigPath" cherry-pick "$commit"; then