やりたいこと
リポジトリ rep1 を作り、それを clone して rep2 を作る。
rep1 の変更と rep2 の変更を互いに受け取る。
/tmp/rep1 にリポジトリを作成
$pwd /tmp $ mkdir rep1 $ cd rep1 $ git init Initialized empty Git repository in /private/tmp/rep1/.git/ $ touch README $ git add $ git commit . -m "first commit"
/tmp/rep2 に rep1 を clone
$ pwd /tmp $ mkdir rep2 $ cd rep2 $ git clone /tmp/rep1 $ cd rep1 $ pwd /tmp/rep2/rep1 $ vi README #=> hello を記述 $ git commit * -m "mod readme" $ git push #=> 変更を rep1 へ
/tmp/rep1 で変更を確認
$ pwd /tmp $ cd rep1 $ git pull #=> エラー出る。 fatal: 'origin': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly $ git checkout -f #=> 変更分をチェックアウト $ cat README #=> rep2 の変更が反映されたか確認 hello $ vi README #=> hello world を記述 $ git commit * -m "mod readme more"
/tmp/rep2 で変更を確認
$ pwd /tmp $ cd rep2/rep1 $ git pull #=> rep1 の変更内容を取得 $ cat README #=> rep1 の変更が反映されたか確認 hello world
rep2 から push したものを rep1 では pull じゃなくて checkout で受け取るもの?