Reputation: 299
I am trying to recover a file that was accidentally removed when I merged a branch to the master.
Now, when I try to do a git checkout of a new branch I get this message:
$ git checkout testingNewFormStyle
D module/FormDependencies/src/FormDependencies/Entity/LanguageList.php
Switched to branch 'testingNewFormStyle'
However, I want to restore that file. How can I do this?
Upvotes: 10
Views: 15731
Reputation: 121740
You can do, for instance:
git checkout HEAD -- module/FormDependencies/src/FormDependencies/Entity/LanguageList.php
This will checkout the file as it exists in the HEAD refspec (ie, the current branch). If HEAD is not what you want, replace with the appropriate refspec.
Upvotes: 26