Afika
Afika

Reputation: 11

How to delete changes in Git on Windows?

Every time I try to add a folder or file to the local repository, I get an error.

 Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   some/path/.gitkeep
        modified:   "\320\262\321\213"

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
        modified:   "\320\262\321\213" (modified content)

How do I delete it "\320\262\321\213".

Upvotes: 1

Views: 167

Answers (3)

torek
torek

Reputation: 489748

You have three different things going on. None of these are errors.

First, you have a submodule.

Second, this submodule's name is вы (Cyrillic characters, with UTF-8 encoding). You have not told Git that it is OK to send Cyrillic characters to your Terminal or iTerm or CMD.EXE or whatever-it-is window, so Git is carefully turning these potentially-window-breaking characters into "\320\262\321\213" for display purposes. To tell Git that it is OK to send these characters directly to your terminal—that they won't break your windowing software—set core.quotePath to false:

git config core.quotePath false

(this sets it just for this repository) or:

git config --global core.quotePath false

(this sets it in your per-user configuration, so that it defaults to being OK to send these to your window no matter which repository you're working in, unless the repository itself overrides this setting).

Last, you've both updated the submodule—so that the next commit you make will say to use a different commit—and you have content in the submodule that is not committed, so that anyone who actually clones the submodule and tries to get the content you have right now, cannot possibly get that content, because it has never been committed, much less pushed to your submodule's upstream.

If you don't want to have a submodule here, you'll need to undo the submodule-ness. If you do want to have a submodule here, see the documentation about working with submodules.

Upvotes: 1

Afika
Afika

Reputation: 11

I understand that he sees a directory called "you" as ""/320\262\321\213". So you can't add a directory to a project in Git?

Am "\320\262\321\213"
?? README.md
?? some/

And it should be in theory

Am "вы"
    ?? README.md
    ?? some/

Upvotes: 0

rubenvb
rubenvb

Reputation: 76785

I would think doing

git rm "\320\262\321\213"

from Git Bash should work.

Alternatively you can remove the file through Explorer (if it's visible at all), and then, to remove it from the index, do

git rm --cached "\320\262\321\213"`

Upvotes: 0

Related Questions