Last active
          August 29, 2015 14:02 
        
      - 
      
- 
        Save darong-khalibre/bdd282fc4b401a0b5354 to your computer and use it in GitHub Desktop. 
    Restore delete files in git
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # show all changes of a file, work even if the file is deleted | |
| git log -- docroot/user_bars/logo.png | |
| # limit the output of Git log to the last commit, i.e. the commit which delete the file | |
| # -1 to see only the last commit | |
| # use 2 to see the last 2 commits etc | |
| git -1 log -- docroot/user_bars/logo.png | |
| # view the content of the file in a specific commit; note that the file is not deleted in that commit | |
| git show f5ac172e docroot/user_bars/logo.png | |
| # restore file from a specific commit | |
| git checkout f5ac172e docroot/user_bars/logo.png | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment