I thought git commit will only commit the staged file to repo,
git ci a.txt
Then the modified a.txt (content: b) was committed to the repo, but not the staged a.txt (content: a)
So What's the command can git commits the staged file to repo , and keep the modified file as usual.
Thanks.

When you do git commit (without a pathspec) you only commit staged changes. So, in order not to commit the new changes to a.txt, instead of doing git ci a.txt just do git commit, which will not commit the new unstaged changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With