I have an artist working in git for a class project. He had an asset in a working directory that was untracked. Before he committed the file, he preformed a pull to get the latest changes. An upper level folder must have been renamed and during the pull the folder he was working in was deleted and all of the tracked files were moved to the new folder. All of the untracked files appear to be deleted. Is there a way to restore the untracked files or to revert the repository using git reflog and git reset?
Asked
Active
Viewed 921 times
0
-
2If the untracked file was not saved anywhere, and the pull really deleted it somehow, then no, the file is probably lost. But I don't seem to recall Git deleting untracked files normally. – Tim Biegeleisen Mar 28 '18 at 05:56
-
That's what my artist is saying. I haven't had a chance to look at his computer yet but it's possible that files weren't deleted but just moved. At the moment I'm just biding my time. – EHMAN Mar 28 '18 at 05:57
-
One speculation is that Git "saw" that one or more untracked files was not being tracked, and then "moved" them to another location. – Tim Biegeleisen Mar 28 '18 at 05:58
-
The artist was working on MacOS. Another possibility is that the folder names caused some unforseen issues. Whenever he pushed a new directory it would add a space to the end of the directory name. Whenever I pulled, GIT would error out and prevent the pull. I would have to manually rename the the folder from 'hello '/ to 'hello'/. When the pull would finish, both folders would be in the directory. I would remove the old folder, 'hello '/, commit changes and push it to the remote. I tried replicating this bug on my local machine, no dice, the untracked files remained. This give me some hope. – EHMAN Mar 28 '18 at 06:03
-
1This sounds like a hack. Generally, if you have an untracked file which you need, add it before pulling. – Tim Biegeleisen Mar 28 '18 at 06:04
-
I will remember to prevent future headaches, thanks. – EHMAN Mar 28 '18 at 06:05
1 Answers
0
Regular configurations of command line git does not have a solution to this problem. However, Git Kraken, a git client interface, has an autostaching feature. This feature allowed my artist to retrieve his assets, even though they had been removed by any means of regular recovery.

EHMAN
- 1