/// <summary> /// Requires absolute path /// </summary> /// <param name="fileName"></param> public void UnStageFile(string fileName) { if (!this.HasGitRepository) return; var fileNameRel = GetRelativeFileName(fileName); if (GitBash.Exists) { if (head == null) { GitBash.Run(string.Format("rm --cached -- \"{0}\"", fileNameRel), this.GitWorkingDirectory); } else { GitBash.Run(string.Format("reset -- \"{0}\"", fileNameRel), this.GitWorkingDirectory); } } else { ResetCommand resetCommand = new Git(repository).Reset(); resetCommand.AddPath(GetRelativeFileNameForGit(fileName)); resetCommand.SetRef(Constants.HEAD); resetCommand.Call(); } this.cache.Remove(GetCacheKey(fileName)); this.changedFiles = null; }