0

Remote repo has a commit that it has some untracked files. I need these files. The current master branch don't have these files.

I used below command to return a specific commit :

git checkout commitID

It gets untracked files. But I delete these files by using command+delete. After this action, checkout doesn't get untracked files. How can I do it?

us2956
  • 476
  • 12
  • 27
  • What do you mean with a commit thas has untracked files, there is no such thing. Please explain. – Lasse V. Karlsen May 18 '18 at 07:58
  • Some files added to repo with older commit(commitFirst). Their names added in gitignore file. Then, these file removed from the repo. Current master branch doesn't have these files. But I need them. To get these files, I use `git checkout commitFirst`. But they are not on my local. – us2956 May 18 '18 at 08:03
  • If they were tracked earlier, then yes, checking out a commit from back when they were tracked should place them in your working folder. – Lasse V. Karlsen May 18 '18 at 08:12
  • I am not sure they were tracked. Because I look commit history from bitbucket, they are not seen in diff files. – us2956 May 18 '18 at 08:18
  • @LasseVågsætherKarlsen Before I delete these file from my local with coomand+delete, I could recover them using `git checkout commitid`. But now, I cannot it. – us2956 May 18 '18 at 08:19
  • Were they ever committed, or just added to .gitignore? – Lasse V. Karlsen May 18 '18 at 08:27
  • Ohh, sorry. This is my fault. Wrong commit id! `git checkout` works for me. – us2956 May 18 '18 at 08:40

1 Answers1

0

If you delete your untracked files once , git can't bring back those files .

I suggest you to look at this question : Here's a link

developer-guy
  • 157
  • 1
  • 6
  • Why? This is only local actions. Remote repo has a history. And I think, these files exists on history stack. – us2956 May 18 '18 at 08:00