Home ›
Restore locally deleted files with gitRestore locally deleted files with git
Submitted by Benjamin Melançon on April 27, 2009 - 5:46am
Searched words:
git restore locally deleted file
In SVN, running svn update will restore any files you have deleted locally where you have not explicitly committed the removal. Not so in git (or at least git-svn) for removed or moved files.
The tip found will restore not just one, but every deleted file. Agaric recommends you check what you're restoring with just git ls-files -d (where -d stands for --delete) first.
git ls-files -d | xargs git checkout --
Resolution
More like this
- Checkout a specific revision of a file with Git
- Harmless Git weirdness: git rm -r does not delete physical files, but doesn't list them as untracked either
- Resolve a conflict to use local files after a merge goes bad in git pull
- Checking the difference between a file modified locally and the repository with git
- Shell commands for untarring (and deleting the archive) a bunch of gzip files


Comments
git ls-files -d -z | xargs -0 git checkout --
git ls-files -d -z | xargs -0 git checkout --
It works fine, but git update
It works fine, but
git update -- .is even simpler.
Post new comment