10

So I was searching around about this and didn't find a exact answer, should be a simple command I think for a simple process.

So basically I want:

How to move them down to untracked so I can easily get them back when I want to push them, how to in a fast way?

Tatu Bogdan
  • 586
  • 2
  • 10
  • 27
  • Well I try'ed that, but that particular file won't be moved to untracked, that file just dissapeared. – Tatu Bogdan Feb 15 '17 at 08:37
  • @axiac git checkout revert only your changes but that file still exists in your and is not really untracked... – René Höhle Feb 15 '17 at 08:39
  • Is there any way to see that files back after I used checkout? – Tatu Bogdan Feb 15 '17 at 09:05
  • No if you make a checkout without a commit you revert your changes ;) that is why i wrote that you should create a new branch... – René Höhle Feb 15 '17 at 09:07
  • An *untracked file* is one that is not in the index. If the file is not in the index, it will not be any *new* commit you make either. See also http://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore – torek Feb 15 '17 at 18:59

1 Answers1

20

There are some possibilities. You can make a new branch checkout the new branch and commit the changes to the new branch and work on that branch.

Your changes will exist if you change the branch only if you have a conflict in that new branch you get an error but if you create a new you have no problems.

If you want to revert your change then you can find the answer in your image.

git checkout filename

with

git rm --cached filename 

you can remove that file from your repo but keep it on you local disk.

René Höhle
  • 26,716
  • 22
  • 73
  • 82