1

I have folder of user data which I thought was .gitignored , however I was wrong and when I did a pull I got a conflict.

Currently, if I type "git status" I get a list of the files ( eg. "deleted: projects/tom/demo_project/1_2.mp3"), but they have actually been deleted.

Is it possible to recover this data?

ismail
  • 46,010
  • 9
  • 86
  • 95
Jim
  • 521
  • 8
  • 14

2 Answers2

2

Assuming everything had previously been added to your local repository, you can use the git reset --hard command to restore your local repository to its state before your git pull command.

This page has more information than you'll ever want about the reset command.

larsks
  • 277,717
  • 41
  • 399
  • 399
0

If the cuckoos might not have been added recently,

git log -a --oneline -- \*/cuckoos/glob/*

will show the commits that added or changed them, and

git log -a --source --decorate --ancestry-path --oneline --graph ^the-1st-of-them

will show everything that's been tainted -- with any luck, a short list all on your current branch. If so, the reset will do you fine. Otherwise you're headed for filter-branch territory.

Unless you've gone in and explicitly told git to get all draconian on your ass, git will forget nothing it has seen in the last 90 days, even things you added and then abandoned without ever committing. You can reproduce and play mix-n-match with anything git has seen.

jthill
  • 55,082
  • 5
  • 77
  • 137