http://fukuoka-cam-study.connpass.com/event/23800/
例)git shell を起動して黒い画面をだす
$ git --version
$ git config --global --list
user.name=xxx
user.email=xxx
...
- コミットした人の情報
$ git config --global user.name なにかしら名前
$ git config --global user.email メールアドレス
- 色で見やすく
$ git config --global color.ui auto
ssh -T git@github.com
↓ 下にログイン
-
右下緑の "+ New Repository" ボタンをクリック
-
Repository name に pull_request_study
-
create repository
-
"SSH"ボタンを押してください
-
"…or create a new repository on the command line"通りにコマンドを打ちます
☆ git remote add でリモート(インターネット上のサーバ)の場所を登録してます ☆
☆ mkdir pull_request_study してその中で作業する
git push -u
オプションの意味 http://qiita.com/ironsand/items/6c301fef730d53f35bc3
$ git branch -vv
- GitHubの画面で自分が作ったプロジェクトができていることを確認
さきほど作成されたGitHubのページを開いてみましょう
https://github.com/fukuoka-tonkotsu
https://github.com/fukuoka-tonkotsu/pull_request_study
右上のforkボタンを押す
↓ができます https://github.com/自分の名前/pull_request_study
$ git clone git@github.com:自分の名前/pull_request_study.git
$ cd pull_request_study
$ git status
$ git remote -v
$ git log
$ git branch
$ git branch hello-world
$ git checkout hello-world
atom .
# or
explorer .
$ git status
$ git add xxx
$ git commit
$ git push origin hello-world
GitHubページをひらく
https://github.com/ユーザ名/pull_request_study
左上のBranchをpushしたbranchの名前(hello-world)に変更してください
New pull requestボタンをクリック
下の差分を確認して Create pull request をクリック
フォーク元のページを開く
https://github.com/fukuoka-tonkotsu/pull_request_study
Pull requestのタブの数値が増えていることに気づく
Pull requestのページを開くと先ほどの内容が来ている
Merge pull requestをクリック
Confirm mergeをクリック
マージされたので最新の状態にする
$ git branch
* hello-world
master
$ git checkout master
$ git branch
hello-world
* master
$ git remote -v
origin git@github.com:itokami1123dev/pull_request_study.git (fetch)
origin git@github.com:itokami1123dev/pull_request_study.git (push)
本家をリモートを追加します
$ git remote add upstream git@github.com:fukuoka-tonkotsu/pull_request_study.git
$ git remote -v
origin git@github.com:itokami1123dev/pull_request_study.git (fetch)
origin git@github.com:itokami1123dev/pull_request_study.git (push)
upstream git@github.com:fukuoka-tonkotsu/pull_request_study.git (fetch)
upstream git@github.com:fukuoka-tonkotsu/pull_request_study.git (push)
本家の最新をとってきます
$ git fetch upstream
$ git branch -va
$ git merge upstream/master master
$ git log --oneline --graph
いったん整理
自分のリモートリポジトリ(フォーク先)を更新
$ git branch -v
# [achead xxx]を確認して
$ git push origin master
作業用に作成したトピックブランチを削除する
$ git branch -d hello-world
# 送るもの:送り先という意味
# 空っぽを送るので削除になる
$ git push origin :hello-world
二人が同じファイルをメンテして衝突させる
README.mdを二人同時に変更してpull requestを送る
pull requestは New pull requestか Compare & pull requestボタン
フォーク元の↓にpull requestがふたつ届いている状態 https://github.com/fukuoka-tonkotsu/pull_request_study/pulls
順にマージしていくと
This branch has conflicts that must be resolved 発生!!!!
2番目の人がupstreamから最新をとってマージできる形にします
$ git checkout master
$ git fetch upstream
$ git merge upstream/master master
自分のトピックブランチに反映
$ git checkout fix-read
$ git rebase master
CONFLICT (content): Merge conflict in README.md 発生!!
$ git status
both modified: README.md
$ vim README.md
$ git add README.md
$ git rebase --continue
$ git log --oneline --graph
$ git push -f origin fix-read
Merge pull requestが押せるようになった
また、あとかたづけ
git-resetは結局何を戻すのか http://qiita.com/fnobi/items/ec036c1b5d7ee5a8517c