いよいよ本題に近づいて参りました。ようやく github の前半3文字を少し理解できるようになったので次は github です。いけいけゴーゴー! (古っ?w)
ここあたりを参考に進めます。さらに
こちらも参考にさせていただきました。
github にアカウントを作ってログインします。検索やら何やらで参加するプロジェクト(と呼ぶのかな?)を探します。そして Fork を・・・。
いいのかな~。本当にいいのかな~。いいや、失敗してもいいって @yusuke さんが言ってくれたし。(正確には「何度でもやり直しできるので」であって失敗していいってわけではないんですがw)えいっ!
・・・とりあえず
デモのrepoで試してみますw
$ ls
sample
$ git clone https://github.com/Sdk0815/Spoon-Knife.git
Initialized empty Git repository in ~/git/Spoon-Knife/.git/
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 24 (delta 7), reused 18 (delta 2)
Unpacking objects: 100% (24/24), done.
$ ls
sample Spoon-Knife
$ cd Spoon-Knife/
$ ls
forkit.gif index.html README
最終的には親に pull request を送るので、fork 元のrepoを足します。
$ git remote -v
origin https://github.com/Sdk0815/Spoon-Knife.git (fetch)
origin https://github.com/Sdk0815/Spoon-Knife.git (push)
$ git remote add upstream https://github.com/octocat/Spoon-Knife.git
$ git remote -v
origin https://github.com/Sdk0815/Spoon-Knife.git (fetch)
origin https://github.com/Sdk0815/Spoon-Knife.git (push)
upstream https://github.com/octocat/Spoon-Knife.git (fetch)
upstream https://github.com/octocat/Spoon-Knife.git (push)
ふむふむ。いい感じ。適当に変更を作る branch を用意します。
$ git checkout -b work
この branch 上で変更を作ります。変更ができたら pull request 用の branch を作ります。
$ git checkout -b fix_css
$ git rebase -i master
Successfully rebased and updated refs/heads/fix_css.
rebase するときに複数の commit を一つにまとめるそうです。そうでないとローカルでいろいろやった変更がサーバー上にも見えちゃうとか。
さていよいよサーバーに push してみますかね。
$ git push origin fix_css
error: The requested URL returned error: 403 while accessing https://github.com/Sdk0815/Spoon-Knife.git/info/refs
fatal: HTTP request failed
おうふ・・・。そういえばそもそもログインとかしてないような・・・。.git/config の origin のところ、https://... を https://Sdk0815@... に変えます。
$ vi .git/config
$ git push origin fix_css
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 285 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://Sdk0815@github.com/Sdk0815/Spoon-Knife.git
* [new branch] fix_css -> fix_css
おおお!できましたね! git push のときにパスワードを聞かれます。
さて今度はブラウザで見てみましょう~。
キター!
最後に pull request です。やり方は
こちら。デモなんでがんがん行きますよ~。まず
のように作業したブランチを選択。そして右上の"Pull Request"ボタンをクリック。
いざ "Send pull request" をクリック~!
おおおおお!
これはなかなか楽しいですなw