Skip to content

Commit d873838

Browse files
authored
Merge pull request #156 from blooop/fix/update-from-template-script
fix: update_from_template.sh fails on first run
2 parents 130c132 + 3620257 commit d873838

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎scripts/update_from_template.sh‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
#! /bin/bash
22
set -eo pipefail
33

4-
git config --global pull.rebase false
5-
git remote add template https://github.com/blooop/python_template.git
4+
TEMPLATE_URL="${TEMPLATE_URL:-https://github.com/blooop/python_template.git}"
5+
BRANCH="${BRANCH:-feature/update_from_template}"
6+
7+
git config pull.rebase false
8+
git remote remove template 2>/dev/null || true
9+
git remote add template "$TEMPLATE_URL"
610
git fetch --all
711
git checkout main && git pull origin main
8-
git checkout -B feature/update_from_template; git pull
12+
git checkout -B "$BRANCH"
913
git merge template/main --allow-unrelated-histories -m 'feat: pull changes from remote template'
10-
git checkout --ours pixi.lock
14+
git checkout --ours pixi.lock 2>/dev/null || true
1115

1216
# regenerate lockfile to match merged pyproject.toml
1317
pixi update
1418
git add pixi.lock
1519
git diff --cached --quiet || git commit -m 'chore: update pixi.lock after template merge'
1620

1721
git remote remove template
18-
git push --set-upstream origin feature/update_from_template
22+
git push --set-upstream origin "$BRANCH"
1923
git checkout main

0 commit comments

Comments
 (0)