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

Limit git autofixup to specified files and/or to staged changes #30

Open
intelfx opened this issue Feb 25, 2024 · 3 comments
Open

Limit git autofixup to specified files and/or to staged changes #30

intelfx opened this issue Feb 25, 2024 · 3 comments

Comments

@intelfx
Copy link

intelfx commented Feb 25, 2024

It would be nice if it was possible to limit git-autofixup to changes in specific files, e. g.:

git autofixup <base> -- /path/to/file /path/to/something/else

Alternatively (might be even more useful), accept something like

  • --staged to only operate on already staged changes (mirroring git stash --staged), and
  • --keep-index for the opposite (mirroring git stash --keep-index).
@krobelus
Copy link
Collaborator

krobelus commented Feb 25, 2024 via email

@torbiak
Copy link
Owner

torbiak commented Feb 25, 2024

Regarding --keep-index: we could get conflicts when trying to restore the original index after doing git-autofixup for the working tree, right?

If I'm understanding correctly, it'd be roughly equivalent to this:

git checkout -b tmp
git commit -m 'saved index'
git checkout topic
git-autofixup
git checkout tmp
git rebase topic
git reset @^

But what if rebasing the saved index onto the changed topic branch fails?

@torbiak
Copy link
Owner

torbiak commented Nov 13, 2024

oh, I guess it'd be a lot nicer to write a --keep-index script as:

git stash push --staged
git-autofixup
git stash pop

Thanks for the suggestions, @intelfx, but to me it seems more flexible, tractable, and lower maintenance for people to write this as a shell script instead of working it into git-autofixup. Apart from convenience, is there an additional advantage that would be gained by having it in git-autofixup?

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

3 participants