title: How to unstage a file during interactive rebase (remove file from old commit)?
body: <p>I've read in <em>Pro Git</em> book about interactive rebases to change several commits. So I'm doing <code>git rebase HEAD~3</code>, changed one which I wanted to amend to <code>edit</code>. Then I was able to change a message via <code>git commit --amend</code>. And added a file via <code>git add file3</code> after which <code>git commit --amend</code> started to output &quot;3 files changed&quot; instead of previous &quot;2 files&quot;. But how to remove a file? Why neither <code>git restore --staged file1</code> nor <code>git reset HEAD file1</code> works? (output of  <code>git commit --amend</code> remains &quot;3 files changed&quot; and output of <code>git log --patch</code> still shows <code>file1</code> for a commit with most recent amended commit message).</p>
  <p>I've used web search and read <a href="https://stackoverflow.com/questions/58003030/what-is-the-git-restore-command-and-what-is-the-difference-between-git-restor">What is the `git restore` command and what is the difference between `git restore` and `git reset`?</a> (as seen above tried both <code>restore</code> and <code>reset</code>), <a href="https://stackoverflow.com/questions/12481639/remove-files-from-git-commit">Remove files from Git commit</a> (talks about last commit), <a href="https://stackoverflow.com/questions/68374103/remove-file-commited-in-old-commit">Remove file commited in old commit</a> (as I understood <code>git filter-branch --index-filter &quot;git rm -rf --cached --ignore-unmatch &lt;path_to_file&gt;&quot; HEAD</code> removes a file from all commits in a branch).</p>
  <p>There is also not upvoted answer <a href="https://stackoverflow.com/questions/58795826/remove-changes-to-file-in-old-already-pushed-git-commit">Remove changes to file in old, already pushed, git commit?</a> with</p>
  <pre><code>git rebase -i HEAD~3 //Change &quot;pick&quot; to &quot;edit&quot; for commit to change
  git reset HEAD^ -- F2 //reset F2 to previous version in staging area  
  </code></pre>
  <p>Is it that to remove a file one need to reset whole commit? One cannot remove a single file during rebase?</p>