From 2f0fd784eb03d19352debb44758657cab5840d97 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 9 Oct 2011 20:15:05 +0200 Subject: [PATCH] force "remove" added files on revert "error: 'filename' has staged content different from both the file and the HEAD (use -f to force removal)" Signed-off-by: Sven Strickroth --- src/Git/Git.cpp | 2 +- src/TortoiseProc/CommitDlg.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index f4bcfb868..5378858d9 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -1519,7 +1519,7 @@ int CGit::Revert(CString commit, CTGitPath &path) } else if(path.m_Action & CTGitPath::LOGACTIONS_ADDED) { //To init git repository, there are not HEAD, so we can use git reset command - cmd.Format(_T("git.exe rm --cached -- \"%s\""),path.GetGitPathString()); + cmd.Format(_T("git.exe rm -f --cached -- \"%s\""),path.GetGitPathString()); if(g_Git.Run(cmd,&out,CP_ACP)) return -1; diff --git a/src/TortoiseProc/CommitDlg.cpp b/src/TortoiseProc/CommitDlg.cpp index 1476cebb6..87a161d82 100644 --- a/src/TortoiseProc/CommitDlg.cpp +++ b/src/TortoiseProc/CommitDlg.cpp @@ -572,7 +572,7 @@ void CCommitDlg::OnOK() //uncheckedLists.insert(entry->GetGitPathString()); if(entry->m_Action & CTGitPath::LOGACTIONS_ADDED) { //To init git repository, there are not HEAD, so we can use git reset command - cmd.Format(_T("git.exe rm --cache -- \"%s\""),entry->GetGitPathString()); + cmd.Format(_T("git.exe rm -f --cache -- \"%s\""),entry->GetGitPathString()); if(g_Git.Run(cmd,&out,CP_ACP)) { CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR); -- 2.11.4.GIT