別のブランチから特定のファイルのみ持ってくる

特定のコミットをマージするには、cherry-pickやパッチですが

mergeした際にconflictしてファイルとディレクトリの名前が被っていたので・・・
conf/memcachedをgit rm -rで一旦mergeのときは削除しておきました。

その後、別ブランチから特定のファイルのみcheckoutしました。

$ git checkout dev conf/memcached
$ git status
# On branch master
# Your branch is ahead of ‘origin/master’ by 12 commits.
#
# Changes to be committed:
# (use “git reset HEAD …” to unstage)
#
# new file: conf/memcached/memcached
# new file: conf/memcached/memcached.backend
# new file: conf/memcached/memcached.category
#

git checkout [branch] [filename]

でできました。

This entry was posted on 金曜日, 10月 4th, 2013 at 8:27 PM and is filed under git. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。