Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA / WebStorm: how to make all files unselected by default in the commit dialog?

When I open the Commit Changes Dialog (Ctrl + K) in WebStorm, it selects all changed/added/removed files. I'd like to avoid accidentally committing files. And often I uncheck all files and then check those files that I want to commit.

Is there a way to disable auto-selection of all files by default in the Commit Dialog (I didn't find such option in the settings)?

like image 756
traxium Avatar asked Dec 06 '16 04:12

traxium


1 Answers

Since you said in the comments that you really wanted to not select one particular file by default, changelog.txt, you can tell Git to ignore changes to that file, and then hopefully WebStorm will not detect the changes either.

There are two similar features for ignoring changes to a file in Git: --assume-unchanged and --skip-worktree. See Git - Difference Between 'assume-unchanged' and 'skip-worktree' for the difference. You probably want --skip-worktree.

You can use it in your case like this:

git update-index --skip-worktree changelog.txt

Now git status won't include your change to changelog.txt in its list.

When you're finally ready to actually commit the change, run

git update-index --no-skip-worktree changelog.txt

The comments of http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html suggest some aliases to make the above commands easier to run, although that article only discusses --assume-unchanged, not --skip-worktree.

like image 94
Rory O'Kane Avatar answered Oct 05 '22 23:10

Rory O'Kane