Skip to content

Commit

Permalink
Added script to undelete specific files from git
Browse files Browse the repository at this point in the history
  • Loading branch information
reinout committed Aug 20, 2024
1 parent abac00d commit 449815f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions shell/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,21 @@ Source code::
# grep -i --color=auto $1


git-undelete
------------------------------------------------------------------------

Undelete a file from git which has been git-rm'ed and git-commit'ed somewhere in the
past. See https://stackoverflow.com/a/1113140/27401

Pass a filename (some_dir/some_file.txt) you want restored.

Source code::

#!/bin/bash

git checkout $(git rev-list -n 1 HEAD -- "$1")^ -- "$1"


md-to-doc
------------------------------------------------------------------------

Expand Down
7 changes: 7 additions & 0 deletions shell/git-undelete
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Undelete a file from git which has been git-rm'ed and git-commit'ed somewhere in the
# past. See https://stackoverflow.com/a/1113140/27401
#
# Pass a filename (some_dir/some_file.txt) you want restored.

git checkout $(git rev-list -n 1 HEAD -- "$1")^ -- "$1"

0 comments on commit 449815f

Please sign in to comment.