user1499672
user1499672

Reputation: 11

Files are missing after adding them to .gitignore and going back to an older revision

I have a strange situation when I remove ignore on some files from .gitignore. As an example if .gitignore include *.txt and after some time I want to add txt files to be versioned, the I remove the line *.txt from .gitignore file, then do commit.

If I try to go back to previous versions, then the *.txt files are missing!

On previous versions, the *.txt files were there, but were un-versioned. Now when I'm trying to go back, I wanted to see the old txt files, but they are missing. I have the txt files only from the version that I added them to the .gitignore.

Is this correct, or am I missing something?

Upvotes: 1

Views: 113

Answers (1)

Alex Wilson
Alex Wilson

Reputation: 6740

Git cannot revert files from before they were versioned. It simply does not record a history for them until you start committing them to a repository.

Upvotes: 4

Related Questions