A Portainer stack deployed from a Git repository can update itself with GitOps updates. One switch next to it, Force redeployment, changes when that happens, and it’s worth knowing what it does.
With GitOps updates on, Portainer checks the repository by polling at the fetch interval you set, or when a webhook is called. Without Force redeployment, it only redeploys when the repository actually changed. With Force redeployment on, it redeploys at every interval or webhook call, even if nothing changed in Git, and it overwrites local changes.
GitOps updates: on
Mechanism: Polling
Fetch interval: 5m
Force redeployment: on
I find that useful when someone tweaks a running stack by hand in Portainer and you want Git to stay the single source of truth. The next poll quietly puts the stack back the way the repository describes it.
It pairs with Re-pull image, which pulls the latest images during an update. Together they make a stack follow both the compose file and a moving tag like latest.
The flip side is that a forced redeploy recreates the containers every interval. With a short interval that means restarts every few minutes, and any quick fix made in the Portainer editor is gone without a warning. I’d keep the interval long and put changes in the repository instead of in the UI.
Further reading: Portainer docs: add a new stack