Skip to content

Fix/prevent git checkout data loss - #1696

Open
mrJakez wants to merge 7 commits into
moghtech:mainfrom
mrJakez:fix/prevent-git-checkout-data-loss
Open

mrJakez wants to merge 7 commits into
moghtech:mainfrom
mrJakez:fix/prevent-git-checkout-data-loss

Conversation

@mrJakez

@mrJakez mrJakez commented Oct 16, 2026

Copy link
Copy Markdown

Summary

This PR introduces a configurable git_update_strategy property for Repository resources, allowing users to control how Komodo handles local, uncommitted changes when updating Git repositories.

Currently, Komodo uses git checkout -f during repository updates. While this ensures a clean checkout, it can silently discard local changes.

This becomes particularly problematic when multiple stacks share the same repository, or when applications modify tracked configuration files at runtime.

The new configuration provides three strategies while maintaining full backward compatibility.

Motivation

Consider a setup where multiple Docker stacks share a single Git repository:

  • Stack A runs Home Assistant, which modifies its automations.yaml at runtime.
  • Stack B runs another application from the same repository.
  • Both stacks reference the same Komodo Repository resource.

When Stack B is redeployed, Komodo updates the shared repository using git checkout -f.

This can silently overwrite Home Assistant's uncommitted changes, even though those files are unrelated to Stack B.

Users should be able to decide how Komodo handles these situations.

New Configuration

A new git_update_strategy property is available in the Repository configuration.

Example:

[repo.config]
git_update_strategy = "stash"

This branch has not been deployed

No deployments
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