'Git in PHPstorm: Unstage files from Git (remove uncommited files from stage)

In PHPStorm's Git interface it's easy to stage files and folders, with the "+Add" option in the "Git >" submenu of the right click context menu. But, how do I remove them from stage?



Solution 1:[1]

I've found an easy (but not obvious) way to remove files from Git in PHPStorm (or any other IntelliJ based IDE) when they still haven't been committed (for example, you "add"/stage some files which will finally not be used).

You just have to right click the file and select "Git > Revert". Since it's still not commited, "reverting" will actually "remove"/unstage the file from Git.

You even have the option to physically remove the file by checking the "Delete local copies of added files" option, or just leave it as it is after removing it from Git by leaving that option unchecked (in that case the file will be shown in red as if it still hadn't been added).

Solution 2:[2]

You have no choice but to use console/terminal for that. git rm -–cached <file> if I'm not mistaken.

They do not plan to implement such rarely used functionality (unless I've missed the newer ticket): http://youtrack.jetbrains.com/issue/IDEA-107359

Solution 3:[3]

To unstage file from phpstorm you ave to right click on file and rollback so the file will be inside unversioned files

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 Mahmoud