Skip to content

Simplify git logic in patternizer-update#616

Merged
mbaldessari merged 1 commit into
validatedpatterns:mainfrom
mbaldessari:more-idempotent
Jul 10, 2026
Merged

Simplify git logic in patternizer-update#616
mbaldessari merged 1 commit into
validatedpatterns:mainfrom
mbaldessari:more-idempotent

Conversation

@mbaldessari

Copy link
Copy Markdown
Contributor

If the remote branch automated/patternizer-update already existed, the
old code did git checkout "$BRANCH" after the patternizer had already
modified files in the working tree. Git refused because uncommitted
changes would be overwritten

So it would fail like this:

```
Changes detected after patternizer update:
.claude/skills/pattern-author/SKILL.md
.claude/skills/pattern-author/reference.md
.cursor/skills/pattern-author/SKILL.md
.cursor/skills/pattern-author/reference.md
pattern.sh
From https://github.com/validatedpatterns/multicloud-gitops
 * branch            automated/patternizer-update -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by checkout:
    .claude/skills/pattern-author/SKILL.md
    .claude/skills/pattern-author/reference.md
    .cursor/skills/pattern-author/SKILL.md
    .cursor/skills/pattern-author/reference.md
Please commit your changes or stash them before you switch branches.
Aborting
```

If the remote branch automated/patternizer-update already existed, the
old code did git checkout "$BRANCH" after the patternizer had already
modified files in the working tree. Git refused because uncommitted
changes would be overwritten

So it would fail like this:

    ```
    Changes detected after patternizer update:
    .claude/skills/pattern-author/SKILL.md
    .claude/skills/pattern-author/reference.md
    .cursor/skills/pattern-author/SKILL.md
    .cursor/skills/pattern-author/reference.md
    pattern.sh
    From https://github.com/validatedpatterns/multicloud-gitops
     * branch            automated/patternizer-update -> FETCH_HEAD
    error: Your local changes to the following files would be overwritten by checkout:
	    .claude/skills/pattern-author/SKILL.md
	    .claude/skills/pattern-author/reference.md
	    .cursor/skills/pattern-author/SKILL.md
	    .cursor/skills/pattern-author/reference.md
    Please commit your changes or stash them before you switch branches.
    Aborting
    ```
@mbaldessari mbaldessari merged commit 81f1e2f into validatedpatterns:main Jul 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant