SlideShare a Scribd company logo
Git/GitHub 超入門
GitHubでたのしいチーム開発
本日のゴール
- Gitたのしい!
- GitHubでチーム開発気持ちい!
git
git
ってなんやろか…
分散バージョン管理システム
…よけいわからん
要すると
分散
して、
バージョン を 管理する
システム
のこと
「バージョン管理」って…?
普段やってること
普段やってること
メモ.txt
メモ
ID: hoge
メモ.txt
メモ
ID: hoge
普段やってること
メモ.txt
メモ
ID: hoge2015
編集中…
普段やってること
メモ.txt
メモ
ID: hoge
メモ.txt
メモ
ID: hoge2015
セーブ!!
普段やってること
メモ.txt
メモ
ID: hoge
メモ.txt
メモ
ID: hoge2015
間違えてた!!
戻したいけど上書きしてんじゃん!!!
バージョンを管理したいとき、
どうしますか?
…よけいわからん
コピーしてバックアップを
とっておく
案その1
コピーをとっておく
最新版index.html
index.html (前のやつ)
index-old.html
index20510620.html
編集用index.htmlindex.html
Git introduction
「バージョン管理」とは
セーブするたびに、
バージョンを振ります
「バージョン管理」とは…
メモ.txt
変更しました!
メモ.txt
セーブしました!
ver. 2
ver. 1
「バージョン管理」とは…
メモ.txt
メモ.txt
やばい間違えてた!
しかも上書きしちゃっ
たよー!!
ver. 2
ver. 1
そんなときにgitなら
メモ.txt
一個前にセーブした
ところ(ver.1)に戻る!
メモ.txt
これで安心!便利!
ver. 2
ver. 1
すべての変更履歴を管理できる
gitのいいところその1
gitのことば
• セーブ = コミット (commit)
• リポジトリ = フォルダ
gitのしくみ
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index.html
style.css
index.html
style.css
commit merge
自分のPCの中
push fetch
みんながみんなのPCで
ネットなくても作業できる
gitのいいところその2
これでgit使える!
$ git add FILENAME
$ git commit -m “message”
$ git push
1. ステージング・エリアに追加
2. ローカルで変更をセーブ
3. ローカルのセーブをリモートにもセーブ
$ git add FILENAME
$ git commit -m “message”
1. ステージング・エリアに追加
2. ローカルで変更をセーブ
$ git add/commit
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index.html
style.css
index.html
style.css
add/commit
自分のPCの中
$ git add FILENAME
$ git commit -m “message”
$ git push
1. ステージング・エリアに追加
2. ローカルで変更をセーブ
3. ローカルのセーブをリモートにもセーブ
$ git push
3. ローカルのセーブをリモートにもセーブ
$ git push
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index.html
style.css
index.html
style.css
自分のPCの中
push
GitHubとは
Git introduction
GitHubは、 Gitのリポジトリ
をホスティングするサービス
gitのしくみ
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index.html
style.css
index.html
style.css
commit merge
自分のPCの中
push fetch
GitHub
Git introduction
チーム開発どうやんの
チーム開発のやりかた
トツカのローカルリポジトリ
index.html
style.css
リモートリポジトリ
(GitHubがホスト)
index.html
style.css
index.html
style.css
commit
merge
fetch
push
彼女と共同作業をするとき
彼女と共同作業をするとき
トツカのローカルリポジトリ
index.html
style.css
index.html
style.css
index.html
style.css
commit
merge
fetch
push
彼女のローカルリポジトリ
index.html
style.css
index.html
style.css
commit
merge
fetch
push
リモートリポジトリ
(GitHubがホスト)
リモートリポジトリ
(GitHubがホスト)
彼女と共同作業をするとき
トツカのローカルリポジトリ
index.html
style.css
index.html
style.css
index.html
style.css
commit
merge
fetch
push
彼女のローカルリポジトリ
index.html
style.css
index.html
style.css
commit
merge
fetch
push
これが分散!!!
チーム開発フロー
チーム開発フロー
• 自分のアカウントにデータを複製 (fork)
• ローカル(自分のPCの中)にデータを持ってくる (clone)
• 編集する
• 変更内容をコミット(セーブ)する (add/commit)
• コミット内容をリモート(GitHub上のソース)に反映する (push)
• Pull Requestをだす (GitHubの画面から!)
1. 複製する (fork)
編集したいデータの複製を自分の
GitHubのアカウントにつくれます
GitHubのページから!!
1. 複製する (fork)
ローカルリポジトリ
リモートリポジトリ
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル
1. 複製する (fork)
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
自分のPCの中
fork
GitHub
(自分のアカウント) index.html
style.css
オリジナル
$ git clone https://github…
2. 自分のPCに持ってくる (clone)
リモート(GitHub)から
ローカル(自分のCP)にデータを持ってきます
* URLはGitHubのページからコピペします
2. 自分のPCに持ってくる (clone)
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
2. 自分のPCに持ってくる (clone)
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index.html
style.css
自分のPCの中
clone
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index.html
style.css
3. 編集する
3. 編集する
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index.html
style.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index.html
style.css
3. 編集する
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index.html
style.css
編集したった!!!!
$ git commit -m “message”
4. コミット(セーブ)する
ローカル(自分のPCの中)で
変更内容をセーブ!
$ git add FILENAME
commit(セーブ)するファイルを選ぶ
4. コミット(セーブ)する
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index.html
style.css
4. コミット(セーブ)する
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index2.html
style2.css
add / commit
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index2.html
style2.css
$ git push
5. リモートに反映する (push)
ローカル(自分のPC)の中の変更を
リモート(GitHub上)のソースに反映します
5. リモートに反映する(push)
ローカルリポジトリ
index.html
style.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index2.html
style2.css
5. リモートに反映する(push)
ローカルリポジトリ
index2.html
style2.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index2.html
style2.css
push
GitHubのページから!!
6. 変更を取り込んでもらう
(pull request)
オリジナルのレポジトリに
「僕の変更を取り込んでくれ!」
とリクエストします
5. 変更を取り込んでもらう(pull request)
ローカルリポジトリ
index2.html
style2.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index2.html
style2.css
5. リモートに反映する(push)
ローカルリポジトリ
index2.html
style2.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index.html
style.css
オリジナル(本体)
index2.html
style2.css
PR
変更したから取
り込んでよー!!
5. リモートに反映する(push)
ローカルリポジトリ
index2.html
style2.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index2.html
style2.css
オリジナル(本体)
index2.html
style2.css
PR
変更したから取
り込んでよー!!
OK!!!
0. みんなの変更を取り込む
$ git pull upstream master
オリジナルの方のリモート(GitHub上)が変更され
ていたら最新版を自分のソースに取り込む
$ git remote add upstream https://
github.com/okadai-techlab/okayama-u-
techlab.com.git
てくらぼのオリジナルの方もリモート先として登録する
* 登録は最初の一回だけでいいよ! ‘upstrem’って名前じゃなくてもいいよ!
5. 変更を取り込んでもらう(pull request)
ローカルリポジトリ
index2.html
style2.cssリモートリポジトリ
index2.html
style2.css
自分のPCの中
GitHub
(自分のアカウント) index3.html
style3.css
オリジナル(本体)
upstream
index2.html
style2.css
誰かが変更した
(最新版)
複製
origin
5. 変更を取り込んでもらう(pull request)
ローカルリポジトリ
index2.html
style2.cssリモートリポジトリ
index3.html
style3.css
自分のPCの中
GitHub
(自分のアカウント) index3.html
style3.css
index3.html
style3.css
pull
オリジナル(本体)
upstream
複製
origin
彼女と共同作業をするとき
トツカのローカルリポジトリ
index.html
style.css
index.html
style.css
index.html
style.css
commit
merge
push
彼女のローカルリポジトリ
index.html
style.css
index.html
style.css
commit
merge
pull
push
リモートリポジトリ
(GitHubがホスト)
upstream
index.html
style.css
index.html
style.css
push pull push
PR PR
複製
origin
チーム開発フロー
• 自分のアカウントにデータを複製 (fork) … 1回目だけ
• ローカル(自分のPCの中)にデータを持ってくる (clone) … 1回目だけ
• 最新版を取り込む (pull)
• 編集する
• 変更内容をコミット(セーブ)する (add/commit)
• コミット内容をリモート(GitHub上のソースorigin)に反映する (push)
• みんなの変更を取り込む (Pull Requestをだす) -> pullに戻る
Demo

More Related Content

PDF
新たなgitのブランチモデル「Git Feature Flow」!Git Flow,Git Hub Flow,Git Lab Flowを超えれるか?
PPTX
Git演習(2)
PDF
やりなおせる Git 入門
PDF
デザイナのためのGit入門
PDF
ゆるふわっGit入門
PDF
GitとGitHubによる chordのバージョン管理 for バンドマン
PDF
とあるぼっち開発者の憂鬱とGit
PDF
Git flowについてまとめてみた
新たなgitのブランチモデル「Git Feature Flow」!Git Flow,Git Hub Flow,Git Lab Flowを超えれるか?
Git演習(2)
やりなおせる Git 入門
デザイナのためのGit入門
ゆるふわっGit入門
GitとGitHubによる chordのバージョン管理 for バンドマン
とあるぼっち開発者の憂鬱とGit
Git flowについてまとめてみた

Viewers also liked (10)

PDF
pecoを使おう
PPTX
Led cube lt
PPTX
Ruby 勉強会 第42回 発表資料 IO について
PDF
はじめてのアマゾンクラウド②[仮想サーバ(Amazon EC2)を立ち上げる]
PDF
DB設計でこだわりたい三つの要素
PPT
An Introduction to Visual Thinking
PDF
セクシー女優で学ぶ画像分類入門
PDF
Get started with dropbox
PDF
WordPressで電子書籍
PDF
EPUBのナビゲーションを理解しよう
pecoを使おう
Led cube lt
Ruby 勉強会 第42回 発表資料 IO について
はじめてのアマゾンクラウド②[仮想サーバ(Amazon EC2)を立ち上げる]
DB設計でこだわりたい三つの要素
An Introduction to Visual Thinking
セクシー女優で学ぶ画像分類入門
Get started with dropbox
WordPressで電子書籍
EPUBのナビゲーションを理解しよう
Ad

Similar to Git introduction (20)

KEY
20120324 git training
PDF
バージョン管理
PDF
Git&GitHub入門
ODP
20130608 git-0
PPTX
GitHubワークショップ
PDF
猫にはわからないGit講座
PDF
ノンプログラマのGit入門
PPT
Githubことはじめ
PDF
Gitとちょっと仲良くなるために覚えたことまとめ
PDF
Git 10min
PDF
Github勉強会
PPTX
超ざっくりとGitについて学ぶ
PPTX
Git勉強会 #01
PDF
Gitのいいところ
PDF
Git -分散バージョン管理システム-
PPTX
Git勉強会資料
PDF
Git for beginners
PDF
git-webtouchmeeting
KEY
Git (実践入門編)
PPT
15分でわかる分散バージョン管理システムgit
20120324 git training
バージョン管理
Git&GitHub入門
20130608 git-0
GitHubワークショップ
猫にはわからないGit講座
ノンプログラマのGit入門
Githubことはじめ
Gitとちょっと仲良くなるために覚えたことまとめ
Git 10min
Github勉強会
超ざっくりとGitについて学ぶ
Git勉強会 #01
Gitのいいところ
Git -分散バージョン管理システム-
Git勉強会資料
Git for beginners
git-webtouchmeeting
Git (実践入門編)
15分でわかる分散バージョン管理システムgit
Ad

Git introduction