Do not auto stage files (git)

Yes I’m another one of those persnickety git people :sweat_smile:

I learned from How to disable .git? how to keep my changes from being automatically committed, but my files are still being automatically staged. I often commit patches so it’s annoying when my files are staged without my knowledge.

Why does auto-staging happen? Is there a way to turn off this behavior? Thanks!

There is, it should be in project settings, near the bottom it says, refresh apps on changes. You can turn that off and you should be good.

Hi @lisakmalins! Auto-staging happens to create a git commit history for Glitch’s rewind feature — typically every ten minutes or so, if I recall correctly. Turning off “refresh apps on changes” only turns off the file watcher’s hot reloading of the live app as you type, not git auto-commits.

While it’s meant to give users that are new to development in general a way to “automagically” get back to a known-good state, it can cause unexpected behaviour when combined with various version-control workflows.

As a workaround, you can add a git hook that will skip autocommits — see ~stop-default-commits for details on how to do this.

Hope this helps!

Hi @angelo, thanks for the reply! Indeed, ~stop-default-commits works like a charm – bummer there’s no workaround to also disable auto-staging.

I agree that auto-staging and auto-committing is a handy default, but personally I would love a setting to turn it off. I recategorized my question as “Feature Ideas” instead of “Glitch Help.”

1 Like