Search code examples
gitgitlabgit-bashrm

How to revert a git rm -r .?


I added my files to local respository, committed the add then removed the files. I wasn't logged into gitlab at the time. how can I revert it?


Solution

  • You can use the git reflog and checkout the last commit where your files exists and commit it again.

    git reflog
        
    git checkout HEAD@{...}