LoginSignup
2
3

More than 5 years have passed since last update.

Gitで消してpushしたファイルを復活させる

Posted at
# 例

# ファイル名とそのパスを探す
git log --stat > gitlog.txt

# そのファイルの最新のコミットIDを取得する
git rev-list -n 1 @ -- [file_to_path]

# そのコミットからそのファイルを復活させる
git co [commit_id]^ -- [file_to_path]
# 具体例

git log --stat > gitlog.txt
> public/js/index.js

git rev-list -n 1 @ -- public/js/index.js
> abcdefg

git co abcdefg^ -- public/js/index.js
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3