GIT: Undoing Delete

Hello

I will put up my question in a very simple scenario to help you guys understand what I actually wanna achieve.

The following is my Repo Structure on github and localmachine


Repo-1
 - Master
 - Bugs/LoginFix

I have a file in Bugs/LoginFix named Login.php that I pushed to Bugs/LoginFix after doing some changes.

After which Bugs/LoginFix was merged to master and Bugs/LoginFix was deleted from github. After which we had to delete Login.php from master for some reason.

I still have Bugs/LoginFix in my local machine. So I ran the following command

> git checkout Bugs/LoginFix
> git pull origin master

Which deleted Login.php from my local branch Bugs/LoginFix and I dont have Login.php anymore in my machine.

How do I un-delete Login.php on my local machine?

Thanks

Assuming you haven’t done any commits since, it would be:

git checkout HEAD^ – Login.php

If yoy have done commits since, first do

git log -p Login.php

note the latest commit sha the file occurs in, and then

git checkout <commit-sha> – Login.php