LK Yeung
LK Yeung

Reputation: 3496

Cannot change a file to untracked

I have tried reset but it doesn't work.how to change a file to untracked?

git status
   untracked files:
   bin
   gen

git add gen
git status
   untracked files:
   bin

git reset gen
git status
   untracked files:
   bin

it doesn't work.is the command right?how to change a file to untracked?

Upvotes: 2

Views: 225

Answers (2)

earlonrails
earlonrails

Reputation: 5182

Did you try using ?

git rm gen

I think that is what you want. Or you can simply rm the file. This will remove the file, but if it is on a different branch then you change branch and it will return. Alternatively you could mv the file out of the tracked directory if you are worried about losing it ie.

mv gen /tmp

I also recommend using gitx app strongly you can just shift things from stagged to unstagged with a double click.

Upvotes: 1

linquize
linquize

Reputation: 20386

git rm --cache gen

does not delete the file, but change to untracked

Upvotes: 4

Related Questions