torbiak/git-autofixup

Limit `git autofixup` to specified files and/or to staged changes

Opened this issue · 2 comments

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).

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?