When using Git with IntelliJ IDEA, pressing Ctrl+K (for VCS Commit Changes...), it shows that what it's about to commit are all the changes, not just what's in the index.
I couldn't seem to find anywhere where it's possible to commit only the index so as of now I'm forced to use CLI's git commit
command without -a
to commit only the index.
By the way if you do a Stash within the IDE, it does give you a checkbox for whether you want to keep the index, so there is an example of the use of indexes in the IDE.
How can committing be done by only committing the index?
So, you got a set of files which are already tracked. Now, when you do git status
these files are marked as modified . At this stage these files are NOT staged. If you run git commit -am "<commit message>"
, you will bypass staging and commit ALL files taht git
system has knowledge of.
In order to keep index and stash everything else
git stash save --keep-index
The above will cause staging area NOT to be stashed. Then you can just run your usual git commit -m "<commit msg>"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.