N
N
NikolayAlb2018-10-21 12:45:19
git
NikolayAlb, 2018-10-21 12:45:19

How to separately undo git add for deleted/new file?

It's strange, but I did not find a solution to such a trivial task in Google.
I have similar changes:

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   modified_file
        deleted:     deleted_file

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        new_file

Adding a file to the stage (git add) works identically for all files.
And how, after adding all the files, to cancel add for specifically new_file/deleted_file? git reset HEAD file_nameworks only for existing files, and when applied to deleted or new files, it simply does not remove them from the stage. Although when used, git reset HEAD *all files are removed, including deleted ones with new ones.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2018-10-21
@NikolayAlb

(use "git add/rm ..." to update what will be committed)

git rm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question