githubでforkしたレポジトリにfork元を追加して使う
fork元のレポジトリ(読み専用)を追加する。
$ git remote add gray git://github.com/gray/webservice-google-reader.git $ git remote show gray origin $ git remote show gray * remote gray Fetch URL: git://github.com/gray/webservice-google-reader.git Push URL: git://github.com/gray/webservice-google-reader.git HEAD branch: master Remote branch: master new (next fetch will store in remotes/gray) Local ref configured for 'git push': master pushes to master (local out of date)
追加したレポジトリの変更をローカルコピーに反映する。
$ git pull gray origin $ git pull gray remote: Counting objects: 29, done. remote: Compressing objects: 100% (17/17), done. remote: Total 21 (delta 8), reused 0 (delta 0) Unpacking objects: 100% (21/21), done. From git://github.com/gray/webservice-google-reader * [new branch] master -> gray/master * [new tag] 0.16 -> 0.16 You asked to pull from the remote 'gray', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line. $ git pull gray 0.08 0.09 0.10 0.12 0.13 0.14 0.15 0.16 HEAD master $ git pull gray master From git://github.com/gray/webservice-google-reader * branch master -> FETCH_HEAD Auto-merging lib/WebService/Google/Reader.pm CONFLICT (content): Merge conflict in lib/WebService/Google/Reader.pm Automatic merge failed; fix conflicts and then commit the result.
コンフリクトがあるのでコンフリクトの解消。
$ vi lib/WebService/Google/Reader.pm
最後に自分のレポジトリにpushして終了。
$ git push Enter passphrase for key '/home/**************************************': Counting objects: 1, done. Writing objects: 100% (1/1), 275 bytes, done. Total 1 (delta 0), reused 0 (delta 0) To git@github.com:**********/webservice-google-reader.git e7c065a..b4de0fb master -> master
日常業務はpullしてコード書いてpushする。これはいつもどおり。