rename.sh update git remote as well
This commit is contained in:
parent
76b89989f1
commit
f4ce4599aa
20
rename.sh
20
rename.sh
@ -177,6 +177,22 @@ if [[ -f CLAUDE.md ]]; then
|
||||
info "CLAUDE.md"
|
||||
fi
|
||||
|
||||
# 8. git remote origin — rewrite URL preserving scheme (https or ssh)
|
||||
if git remote get-url origin &>/dev/null 2>&1; then
|
||||
OLD_REMOTE=$(git remote get-url origin)
|
||||
# Detect scheme and build new URL accordingly
|
||||
if [[ "$OLD_REMOTE" == https://* ]]; then
|
||||
NEW_REMOTE="https://${DEFAULT_HOST}/${NEW_ORG}/${NEW_PROJECT}.git"
|
||||
else
|
||||
# SSH form: git@host:org/project.git or ssh://git@host/org/project.git
|
||||
NEW_REMOTE="git@${DEFAULT_HOST}:${NEW_ORG}/${NEW_PROJECT}.git"
|
||||
fi
|
||||
git remote set-url origin "$NEW_REMOTE"
|
||||
info "git remote origin → ${NEW_REMOTE}"
|
||||
else
|
||||
warn "No 'origin' remote found — skipping remote update."
|
||||
fi
|
||||
|
||||
# ── Post-rename suggestions ───────────────────────────────────────────────────
|
||||
heading "Done"
|
||||
echo "Module is now: ${BOLD}${NEW_MODULE}${RESET}"
|
||||
@ -186,6 +202,4 @@ echo " go mod tidy # sync go.sum after path change"
|
||||
echo " make mocks # regenerate mocks with new import paths"
|
||||
echo " make build # verify it compiles"
|
||||
echo " make test # verify tests pass"
|
||||
echo
|
||||
warn "If you renamed the directory on disk, update git remote too:"
|
||||
echo " git remote set-url origin git@${DEFAULT_HOST}:${NEW_ORG}/${NEW_PROJECT}.git"
|
||||
echo " git push -u origin main"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user