`git_index_clear` does that.