When I type
c-c (type c twice) in staged files, it will commit all the staged files, however i only want to commit a single file of the staged files.
How to do it? Thx.
When I type
You can't just commit a part of the index. The index/staging area is where your next commit is built. Asking to commit only part of it makes no sense.
I'm going to speculate that you've staged a bunch of changes, you don't want to unstage them all (because then you'd need to work through all the changes again to find and re-stage them), but you've realised you actually wanted to make multiple commits out of what you've staged.
There are many ways you could achieve the end goal. A couple of fairly straightforward options are:
a) Unstage the bit you wanted to commit, and then go ahead and commit the rest. Then stage and commit the thing you wanted to commit first. If you're unhappy with the commit order, re-order them afterwards in an interactive rebase.
b) Using Magit's stashing facilities, stash the worktree (only), leaving you with no changes other than what is staged. Now unstage everything, and re-stage the thing you want to commit first (and commit it). Then re-stage all of the unstaged changes and finally apply the stash to get back to where you started (new commit excepted).