当我在 WebStorm 中打开提交更改对话框 (Ctrl + K) 时,它会选择所有更改/添加/删除的文件。我想避免意外提交文件。我经常取消选中所有文件,然后选中那些我想提交的文件。
有没有办法在提交对话框中默认禁用所有文件的自动选择(我在设置中没有找到这样的选项)?
最佳答案
既然你在评论中说你真的不想默认选择一个特定的文件,changelog.txt
,你可以告诉 Git 忽略对该文件的更改,然后希望 WebStorm 不会检测变化。
在 Git 中有两个类似的忽略文件更改的功能:--assume-unchanged
和 --skip-worktree
。参见 Git - Difference Between 'assume-unchanged' and 'skip-worktree'为了区别。您可能需要 --skip-worktree
。
您可以像这样在您的情况下使用它:
git update-index --skip-worktree changelog.txt
现在 git status
不会将您对 changelog.txt
的更改包含在其列表中。
当您最终准备好实际提交更改时,运行
git update-index --no-skip-worktree changelog.txt
http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html的评论建议使用一些别名以使上述命令更易于运行,尽管那篇文章仅讨论了 --assume-unchanged
,而不是 --skip-worktree
。
关于git - IntelliJ IDEA/网络 Storm : how to make all files unselected by default in the commit dialog?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40988071/