Aleks
Aleks

Reputation: 5388

How to restore deleted file which got deleted on branch merge?

I had a file, for example ~/project/config/myconfig.yml and it was ignored by the git in the .gitignore

But now, when I have merged master, the file got lost, deleted, and as it was never pushed to the git (as it was ignored), I can't find it in the logs.

How to restore that myconfig.yml file?

Upvotes: 2

Views: 371

Answers (1)

TM90
TM90

Reputation: 700

  1. If the file was never tracked you cannot restore it!

  2. But the main question here is what happended?

A merge cannot delete a file which is not tracked, even if the .gitignore is changed.

My guess is that you may used git stash -a or git stash --all at some point.

I would recommand you to try git stash pop which may restore previous stashed files.

This last part is just a guess but it should be given a try.

Upvotes: 2

Related Questions