R.A. Epigonos et al.

[git] あるコミットからファイルを取り出す

適当なコミットやブランチからgit 管理対象のファイルを取り出すには、checkout、show、cat-file と 3 種類ある

checkout の場合は、コミット c6c3015 の po/ja.po で現在の po/ja.po を置き換える。

$ git checkout c6c3015 po/ja.po

cat-file の場合は、コミット c6c3015 の po/ja.po を標準出力にリダイレクト。リダイレクト先を po/ja.po.c6c3015 とすることでファイルを取り出すことができる。

$ git cat-file -p c6c3015:po/ja.po > po/ja.po.c6c3015

show は cat-file と同様。

$ git show c6c3015:po/ja.po > po/ja.po.c6c3015

リファレンス

  1. Git - git-show Documentation
  2. Git - git-cat-file Documentation
  3. Git - git-checkout Documentation

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2008-10-29T21:57:01+09:00
  2. Modified: 2008-10-29T21:57:01+09:00
  3. Generated: 2023-08-27T23:09:17+09:00