I
I
Ivan Vekov2018-05-08 16:34:14
git
Ivan Vekov, 2018-05-08 16:34:14

Git: how to remove certain files from 'untracked'?

Suppose at the moment the command
git status
produces the result:

On branch master
Changes not stages for commit:
 ....
modified: file1.php

Untracked files:
...
file2.php
file3.php
....

I need that in Untracked files: only file3.php remains, and file2.php is gone.
I know that there is
git clean -f
But it demolishes both files.
The question, respectively, is whether it is possible to remove one file and leave the other?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
youngmysteriouslight, 2018-05-09
@youngmysteriouslight

$ git clean -i
Would remove the following items:
  file2.php  file3.php
*** Commands ***
    1: clean                2: filter by pattern    3: select by numbers
    4: ask each             5: quit                 6: help
What now> a
remove file2.php? y
remove file3.php? n
Removing file2.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question