Skip to main content
Copy edited (e.g. ref. <http://en.wikipedia.org/wiki/Git_%28software%29>). Added some context.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

In many cases, it can be useful to use coreutilscoreutils (grep,sed sed,etc etc.) in conjunction with gitGit. I I already know these tools quite well, but gitGit less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 $'D\t.*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.

In many cases, it can be useful to use coreutils(grep,sed,etc.) in conjunction with git. I already know these tools quite well, but git less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 $'D\t.*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.

In many cases, it can be useful to use coreutils (grep, sed, etc.) in conjunction with Git. I already know these tools quite well, but Git less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 $'D\t.*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.

added 2 characters in body
Source Link
Thomas E
  • 3.8k
  • 2
  • 22
  • 13

In many cases, it can be useful to use coreutils(grep,sed,etc.) in conjunction with git. I already know these tools quite well, but git less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 'D $'D\t.*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.

In many cases, it can be useful to use coreutils(grep,sed,etc.) in conjunction with git. I already know these tools quite well, but git less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 'D .*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.

In many cases, it can be useful to use coreutils(grep,sed,etc.) in conjunction with git. I already know these tools quite well, but git less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 $'D\t.*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.

Source Link
Thomas E
  • 3.8k
  • 2
  • 22
  • 13

In many cases, it can be useful to use coreutils(grep,sed,etc.) in conjunction with git. I already know these tools quite well, but git less so. If I wanted to do a search for a deleted file, I would do the following:

git log --raw | grep -B 30 'D .*deleted_file.c'

When I find the revision/commit:

git checkout <rev>^ -- path/to/refound/deleted_file.c

Just like others have stated before me.

The file will now be restored to the state it had before removal. Remember to re-commit it to the working tree if you want to keep it around.