Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Git & GitHub
Search
Latte72
August 07, 2025
Programming
0
120
Introduction to Git & GitHub
講習会で利用した Git と GitHub の入門用資料です。
古い情報や間違った情報が含まれる可能性があります。ご了承ください。
Latte72
August 07, 2025
Tweet
Share
More Decks by Latte72
See All by Latte72
x86-64 Assembly Essentials
latte72
7
4.5k
Other Decks in Programming
See All in Programming
エンジニアのための”最低限いい感じ”デザイン入門
shunshobon
0
130
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
180
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
330
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.4k
TDD 実践ミニトーク
contour_gara
1
250
Claude Codeで実装以外の開発フロー、どこまで自動化できるか?失敗と成功
ndadayo
2
1.7k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
230
testingを眺める
matumoto
1
120
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
17
9.1k
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
530
Jakarta EE Core Profile and Helidon - Speed, Simplicity, and AI Integration
ivargrimstad
0
240
令和最新版手のひらコンピュータ
koba789
14
8.1k
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
184
22k
Practical Orchestrator
shlominoach
190
11k
A Modern Web Designer's Workflow
chriscoyier
696
190k
Navigating Team Friction
lara
189
15k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Site-Speed That Sticks
csswizardry
10
800
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
How STYLIGHT went responsive
nonsquared
100
5.8k
Designing for humans not robots
tammielis
253
25k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Typedesign – Prime Four
hannesfritz
42
2.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
Transcript
Introduction to Git & GitHub Latte72 Introduction to Git &
GitHub by Latte72 1 / 52
目次 1. Git と GitHub の関係 2. Git のインストール 3.
Repository の基本操作 4. GitHub への登録 5. GitHub の基本操作 6. Pull Request について 7. コンフリクトとその解決方法 8. GitHub Actions の活用 9. おまけ 10. まとめ Introduction to Git & GitHub by Latte72 2 / 52
1. Git と GitHub の関係 Introduction to Git & GitHub
by Latte72 3 / 52
1.1 Git とは? ソースコードのバージョン管理システム Git の特徴 各開発者が独立して作業できる 新しい機能の開発やバグ修正を切り分けて行える 変更履歴を詳細に記録し過去の状態に簡単に戻すことができる ⇒
チーム開発が効率的に行える! Introduction to Git & GitHub by Latte72 4 / 52
1.2 GitHub とは? Git をさらに便利にするためのサービス GitHub の特徴 Microsoft が提供するプラットフォーム オンラインで
Git リポジトリを管理できる Pull Request やコードレビューの機能がある Issue トラッキングや GitHub Actions など機能が豊富 ⇒ チーム開発がさらに効率的に行える! Introduction to Git & GitHub by Latte72 5 / 52
1.3 GitHub 以外の Git ホスティングサー ビス GitLab: オープンソースの Git ホスティングサービス
Bitbucket: Atlassian が提供する Git ホスティングサービス Gitea: 軽量な Git ホスティングサービス Codeberg: オランダの非営利団体が運営するサービス Introduction to Git & GitHub by Latte72 6 / 52
2. Git のインストール Introduction to Git & GitHub by Latte72
7 / 52
2.1 Windows 1. 公式サイト から Git for Windows をダウンロード 2.
インストーラの指示に従い、 基本的には「Next」を押していけば OK 3. インストール後、Git Bash を開いて git --version を実行 ⇒ 表示されれば完了 Introduction to Git & GitHub by Latte72 8 / 52
2.2 macOS Homebrew をインストールする (未インストールの場合のみ) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
以下のコマンドで Git をインストールする brew install git インストール後、ターミナルで git --version を実行 ⇒ 表示されれば完了 Introduction to Git & GitHub by Latte72 9 / 52
2.3 Ubuntu 以下のコマンドで Git をインストールする sudo apt update sudo apt
install git インストール後、ターミナルで git --version を実行 ⇒ 表示されれば完了 (その他の OS の場合は、公式サイト を参照してください) Introduction to Git & GitHub by Latte72 10 / 52
2.4 初期設定とエイリアス Git の初期設定を行います。以下のコマンドを実行してください git config --global user.name "Your Name"
git config --global user.email "
[email protected]
" これにより、コミットした人の名前とメールアドレスが記録されます ※ 実際の名前とメールアドレスに置き換えてください Introduction to Git & GitHub by Latte72 11 / 52
3. Repository の基本操作 Introduction to Git & GitHub by Latte72
12 / 52
3.1 新規リポジトリの作成 git init 今いるディレクトリに .git フォルダを生成 既存フォルダをそのまま Git 管理下に置ける
Introduction to Git & GitHub by Latte72 13 / 52
3.2 リモートリポジトリからの取得 git clone <URL> リモートにあるリポジトリを丸ごとコピーする origin というリモートが自動で設定される 主に GitHub
上のリポジトリを取得する際に使用 Introduction to Git & GitHub by Latte72 14 / 52
3.3 変更の記録 git add <ファイル> git commit -m "メッセージ" 1.
add でステージに載せる 2. commit でスナップショットを作成 コミットメッセージは簡潔に要点をまとめる! Introduction to Git & GitHub by Latte72 15 / 52
3.3 変更の記録 (続き) git add でステージングエリアに変更を追加 git commit でリポジトリに変更を記録 Introduction
to Git & GitHub by Latte72 16 / 52
3.4 ファイルの移動と削除 ファイルを移動または名前変更する場合 git mv <旧ファイル名> <新ファイル名> ファイルを削除する場合 git rm
<ファイル> ※ この手順を踏まないとGit の管理下で反映されないので注意 Introduction to Git & GitHub by Latte72 17 / 52
3.5 ファイルの変更の取り消し 作業ツリーの変更を取り消す場合 git restore <ファイル> ステージングエリアにある変更を取り消す場合 git restore --staged
<ファイル> Introduction to Git & GitHub by Latte72 18 / 52
3.6 リモートリポジトリに送信 git push origin main origin = GitHub 側のリポジトリ
main = 送りたいブランチ名 初回は git push -u origin main で追跡設定を作成 Introduction to Git & GitHub by Latte72 19 / 52
3.7 ブランチの操作 新しいブランチを作ってそのまま移動 git switch -c <ブランチ名> 既存のブランチに移動 git switch
<ブランチ名> Introduction to Git & GitHub by Latte72 20 / 52
3.8 その他の主な Git コマンド 作業ツリーの状態を確認 git status 変更内容の差分を表示 git diff
コミット履歴を簡潔に表示 git log --oneline --graph Introduction to Git & GitHub by Latte72 21 / 52
3.8 その他の主な Git コマンド (続き) コミット履歴をグラフ形式で表示 Introduction to Git &
GitHub by Latte72 22 / 52
3.9 .gitignore の設定 特定のファイルやフォルダを Git の管理から除外する .gitignore ファイルをプロジェクトルートに作成 例: #
一時ファイル *.tmp *.log # ビルド成果物 build/ # IDE の設定ファイル .vscode/ Introduction to Git & GitHub by Latte72 23 / 52
4. GitHub への登録 Introduction to Git & GitHub by Latte72
24 / 52
4.1 GitHub アカウントの作成 1. https://github.com/ で Sign up 2. ユーザ名・メール・パスワードを登録
3. 認証メールを確認し、ログイン 4. プロフィール設定は後からでも変更可能 Introduction to Git & GitHub by Latte72 25 / 52
4.2 SSH キーの設定 GitHub との通信を行うためには SSH キーを設定する必要があります 1. ターミナルで以下を実行 ssh-keygen
-t ed25519 -C "
[email protected]
" 2. 表示されたパスに秘密鍵が生成される 3. .pub ファイル内にある公開鍵をコピー ※ SSH キーを設定していないとパスワード認証をするよう求められま すが、すでに非推奨で利用できません Introduction to Git & GitHub by Latte72 26 / 52
4.2 SSH キーの設定 (続き) 4. GitHub の設定画面で SSH キーを追加 5.
ターミナルで以下を実行して接続確認 ssh -T
[email protected]
成功すれば、Hi Latte72R! といったメッセージが表示される Introduction to Git & GitHub by Latte72 27 / 52
5. GitHub の基本操作 Introduction to Git & GitHub by Latte72
28 / 52
5.1 リポジトリ作成 1. GitHubのトップページで「New repository」をクリック 2. 名前と設定を入力して「Create repository」 3. 生成されたURLをコピーし、
git clone <URL> で取得 Introduction to Git & GitHub by Latte72 29 / 52
5.2 Issue タスク管理・バグ報告に活用 ラベルやアサインで整理 Introduction to Git & GitHub by
Latte72 30 / 52
5.3 Star & Fork Star お気に入り登録 Fork 自分のアカウントに複製して改造できる OSS プロジェクトで
Pull Request を送る際に利用 Introduction to Git & GitHub by Latte72 31 / 52
6. Pull Request について Introduction to Git & GitHub by
Latte72 32 / 52
6.1 Git を使った開発の流れ 例) xxx という新機能を追加する場合 1. git switch -c
feature/xxx で新しいブランチを切る 2. コードを追加・修正 3. git switch main で main ブランチに移動 4. git merge feature/xxx でマージ 5. git push origin main でリモートに送信 Introduction to Git & GitHub by Latte72 33 / 52
6.2 Pull Request とは PR =「変更を取り込んで」というお願い Git での変更を GitHub 上でレビューしてもらうためのリクエスト
他の開発者にコードを見てもらい、問題がないか確認 問題がなければ、 main ブランチにマージしてもらう コードレビューの文化を育てるために重要なプロセス Issue と連携して、タスク管理も行える Introduction to Git & GitHub by Latte72 34 / 52
6.2 Pull Request の流れ 基本は Git と同じ流れ 新しいブランチを切って作業 GitHub 上で
Pull Request を作成 コンフリクトがないか確認 レビューを受ける 問題なければマージ Introduction to Git & GitHub by Latte72 35 / 52
6.3 ブランチの命名規則 feature/ :新機能の追加 例) feature/include-path :インクルードパス( -I )の追加 fix/
:バグ修正 例) fix/invalid-alignment :アライメント不良の修正 test/ :テストコードの追加・修正 例) test/function-pointer :関数ポインタのテスト追加 docs/ :ドキュメントの更新 例) docs/readme-update :README の更新 Introduction to Git & GitHub by Latte72 36 / 52
7. コンフリクトとその解決方法 Introduction to Git & GitHub by Latte72 37
/ 52
7.1 コンフリクトとは 同じ行を変更 ⇒ Git が自動マージできない 典型例: main から 2
本のブランチが同じ行を編集 先にマージされた変更を、もう一方が取り込むときに発生 複数人が同時に同じファイルを編集した場合によく発生する Introduction to Git & GitHub by Latte72 38 / 52
7.1 コンフリクトとは(続き) コンフリクトのイメージ Introduction to Git & GitHub by Latte72
39 / 52
7.2 コンフリクトの解決手順 Git を使う場合 例) feature/xxx を main にマージするとき 1.
git fetch origin を実行して最新を取得 2. git merge origin feature/xxx → コンフリクト発生 3. 衝突箇所 <<<<<<< をエディタで修正 4. git add → git commit で確定 5. 再度 git push Introduction to Git & GitHub by Latte72 40 / 52
7.2 コンフリクトの解決手順 (続き) GitHub 上での解決 1. コンフリクトが発生したプルリクエストを開く 2. GitHub の
UI 上で衝突箇所を修正 3. 修正が完了したら、プルリクエストを更新 4. 再度レビューを受けて問題なければマージ Introduction to Git & GitHub by Latte72 41 / 52
8. GitHub Actions の活用 Introduction to Git & GitHub by
Latte72 42 / 52
8.1 CI / CD とは? Continuous Integration 変更を頻繁にマージし、自動でビルドとテストを回して品質を保つ Continuous Delivery
常にリリース可能な状態になるように調整(デプロイは手動で行う) Continuous Deployment テストが通ったら自動で本番環境にデプロイする Introduction to Git & GitHub by Latte72 43 / 52
8.2 GitHub Actions とは GitHub リポジトリに CI / CD を簡単に組み込める仕組み
YAML ファイルを .github/workflows/ に置くだけ! 例: プッシュ時にテスト自動実行 main ブランチにマージで自動デプロイ Introduction to Git & GitHub by Latte72 44 / 52
9. おまけ Introduction to Git & GitHub by Latte72 45
/ 52
9.1 GitHub Education 学生向けに無料で GitHub Pro を提供 GitHub Education で登録
GitHub Copilot の利用制限が緩和される 外部パートナーのツール・サービスも充実 学生証やメールアドレスで認証が必要 Introduction to Git & GitHub by Latte72 46 / 52
9.1 GitHub Education (続き) Microsoft Azure や JetBrains のツールが無料 Introduction
to Git & GitHub by Latte72 47 / 52
9.2 README について README.md に記述する プロジェクトの概要や使い方を記載 Markdown 形式で書くのが一般的 GitHub 上で自動的に表示される
Introduction to Git & GitHub by Latte72 48 / 52
9.3 ライセンスについて プロジェクトの利用規約や条件を明記 (免責事項や再配布条件など) LICENSE ファイルに記載する 以下のような種類がある MIT License Apache
License 2.0 GPL License こだわりがなければ MIT License がおすすめ Introduction to Git & GitHub by Latte72 49 / 52
10. まとめ Introduction to Git & GitHub by Latte72 50
/ 52
10.1 まとめ Git と GitHub を活用することで 効率的なチーム開発が可能になる バージョン管理が容易になる コードレビューや CI/CD
が簡単に行える 実際のプロジェクトで活用してみてください! Introduction to Git & GitHub by Latte72 51 / 52
Thank You! Introduction to Git & GitHub by Latte72 52
/ 52