Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9f035a6

Browse files
committed
restore file from git
1 parent5631b3c commit9f035a6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎20_restore_file_from_git.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fromsubprocessimportcheck_output,call
2+
3+
4+
file_name=str(raw_input('Enter the file name: '))
5+
commit=check_output(["git","rev-list","-n","1","HEAD","--",file_name])
6+
printstr(commit).rstrip()
7+
call(["git","checkout",str(commit).rstrip()+"~1",file_name])
8+
9+
10+
"""
11+
After entering a filename, this script searches your Git history for that file.
12+
If the file exists, then it will restore it.
13+
"""

‎readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@
1717
1.**15_check_my_environment.py**: Pass in a config file based on your environment.
1818
1.**16_jinja_quick_load.py**: Render a quick Jinja2 template
1919
1.**17_rewrite_git_history.md**: Backdating/Rewriting Git history (use at your own risk)
20-
1.**18_zipper.py**: Zip contents of a directory, adding a timestamp to the filename
20+
1.**18_zipper.py**: Zip contents of a directory, adding a timestamp to the filename
21+
1.**19_tsv-to-csv.py**: Convert TSV to CSV
22+
1.**20_restore_file_from_git.py**: Restore file from Git History

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp