From 583bc17b5ceef49d41b82abaf16bb8312c1b494a Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 10 May 2018 12:28:36 +0300 Subject: [PATCH] IDEA-191309 git: update staging area using "--cached" argument on commit fix "error: the following file has local modifications" on attempt to call `git rm -- ` on a renamed file, excluded from commit. This might be caused by git pre-commit-hook, that created file with that path during the commit. (so no now it is a modification + new file, and not a rename). --- .../git4idea/src/git4idea/checkin/GitCheckinEnvironment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java index c69501bf9b47..203a71586c4c 100644 --- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java +++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java @@ -658,7 +658,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment { } if (!removed.isEmpty()) { try { - GitFileUtils.delete(project, root, removed, "--ignore-unmatch"); + GitFileUtils.delete(project, root, removed, "--ignore-unmatch", "--cached"); } catch (VcsException ex) { exceptions.add(ex);