Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stg refresh without staged changes #161

Closed
joefiorini opened this issue Oct 27, 2021 · 1 comment
Closed

stg refresh without staged changes #161

joefiorini opened this issue Oct 27, 2021 · 1 comment

Comments

@joefiorini
Copy link

Currently it seems I can run stg refresh and even if there are no staged changes it still refreshes. This can lead to false confidence if I've forgotten to stage my changes. Similar to my change for stg commit, could stg refresh also reject unless the index has files (once again with an --allow-empty flag)? Or at the very least emit a warning?

@jpgrayson
Copy link
Collaborator

It is a pretty fundamental StGit behavior for refresh to take unstaged changes from the worktree, bypassing the index. I don't think this behavior can be reasonably changed without breaking many (all?) StGit users' workflows.

That said, I appreciate that refresh bypassing the index is also fundamentally different from how git commit works, so I think what you're asking for is reasonable. Running stg refresh -i will give you behavior closer to how git commit works; i.e. stg refresh -i will only take changes staged in the index and will not take changes from the worktree.

A possible change we could make to make stg refresh -i behave even closer to what you're asking would be to make stg refresh -i abort if there is nothing staged in the index. With this change, running stg refresh -i would either capture the changes you've staged in the index, or complain that there is nothing to do (as git commit also does).

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

No branches or pull requests

2 participants