Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Gitの仕組みと用語 / GitHub Term
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kaityo256
PRO
October 01, 2021
Education
32k
54
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Gitの仕組みと用語 / GitHub Term
物理情報工学ソフトウェア開発演習
kaityo256
PRO
October 01, 2021
More Decks by kaityo256
See All by kaityo256
What is XAI?
kaityo256
PRO
0
170
勾配ブースティングと決定木の話 / gradient boosting and decision trees
kaityo256
PRO
7
1.8k
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
6k
この講義について / 00-setup
kaityo256
PRO
2
520
GitHubによるWebアプリケーションのデプロイ / 07-github-deploy
kaityo256
PRO
2
430
演習:Gitの基本操作 / 04-git-basic
kaityo256
PRO
1
700
演習:Gitの応用操作 / 05-git-advanced
kaityo256
PRO
1
390
演習:GitHubの基本操作 / 06-github-basic
kaityo256
PRO
1
490
バージョン管理とは / 01-a-vcs
kaityo256
PRO
2
510
Other Decks in Education
See All in Education
観察、仮説、実行、検証、計画、提案を一年で3000回トレーニングする方法/3000 Thinking Loops in 365 Days
moriyuya
5
1.3k
AIがコードを書く時代に、何を教えるのか / What Should We Teach in the Age of AI-Generated Code?
ichiroc
1
560
[2026前期火5] 論理学(京都大学文学部 前期 第6回)「かつとまたはの規則」
yatabe
0
510
「答えを出す」より「わかる」をつくる
kzkmaeda
1
300
NDIAS Automotive / IoT CTF 2026 Recap - Keyfob & OSINT
himitu23
0
340
ちいかわを読め
uchi8977
1
350
Plano urbano de Madrid desde el Ensanche al s. XXI (2ª parte).
juanmartin2026
1
76k
解決策を教えても次期リーダーは育たない ─ 器の発達に伴走するために / Partnering with leaders in their vertical development
matsu0228
1
720
焦燥を平穏に変えるエンジニアのための哲学
ichimichi
7
6.9k
良書紹介08_ 頭のいい子がやっているすごいグラフの読み方
bunnchinn3
0
160
形骸化しない社内勉強会の取り組み - オーナーシップの作り方 / In-house study session
soudai
PRO
1
280
批判的応用言語学ワークショップ(2026-08-12 お茶の⽔⼥⼦⼤学)
terasawat
0
190
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.2k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
Abbi's Birthday
coloredviolet
4
10k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
940
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
Transcript
1 39 Gitの仕組みと用語 慶應義塾大学理工学部物理情報工学科 渡辺 物理情報工学ソフトウェア開発演習
2 39 Gitは簡単ではない
3 39 git init git add git commit git status
git diff git log git clone git remote git fetch git switch git merge git rebase ローカルリポジトリの操作 ブランチの操作 状態や歴史の確認 リモートとのやりとり 「とりあえず」でも こんなにある
4 39 --abbrev-commit --abbrev[=<n>] --after=<date> --all --all-match --alternate-refs --ancestry-path --anchored=<text>
--author-date-order --author=<pattern> --basic-regexp --before=<date> --binary --bisect --boundary --branches[=<pattern>] --break-rewrites[=[<n>][/<m>]] --cc --check --cherry --cherry-mark --cherry-pick --children --color-moved-ws=<modes> --color-moved[=<mode>] --color-words[=<regex>] --color[=<when>] --combined-all-paths --committer=<pattern> --compact-summary --cumulative --date-order --date=<format> --decorate-refs- exclude=<pattern> --decorate-refs=<pattern> --decorate[=short|full|auto|no] --dense --dense --diff-merges=[options] --dirstat-by-file[=<param1,param2>…] --dirstat[=<param1,param2,…>] --do-walk --dst-prefix=<prefix> --encoding=<encoding> --exclude=<glob-pattern> --expand-tabs=<n> --ext-diff --extended-regexp --find-copies-harder --find-copies[=<n>] --find-object=<object-id> --find-renames[=<n>] --first-parent --fixed-strings --follow --format=<format> --full-diff --full-history --full-index --function-context --glob=<glob-pattern> --graph --grep-reflog=<pattern> --grep=<pattern> --histogram --ignore-all-space --ignore-blank-lines --ignore-cr-at-eol --ignore-matching-lines=<regex> --ignore-missing --ignore-space-at-eol --ignore-space-change --ignore-submodules[=<when>] --indent-heuristic --inter-hunk-context=<lines> --invert-grep --irreversible-delete --ita-invisible-in-index --left-only --left-right --line-prefix=<prefix> --log-size --max-count=<number> --max-parents=<number> --merge --merges --min-parents=<number> --minimal --name-only --name-status --not --notes[=<ref>] --numstat --oneline --output-indicator-context=<char> --output-indicator-new=<char> --output-indicator-old=<char> --output=<file> --parents --patch --patch-with-raw --patch-with-stat --patience --perl-regexp --pickaxe-all --pickaxe-regex --pretty[=<format>] --raw --reflog --regexp-ignore-case --relative-date --relative[=<path>] --remotes[=<pattern>] --remove-empty --reverse --right-only --rotate-to=<file> --shortstat --show-linear-break[=<barrier>] --show-notes[=<ref>] --show-pulls --show-pulls --show-signature --simplify-by-decoration --simplify-merges --since=<date> --single-worktree --skip-to=<file> --skip=<number> --source --sparse --src-prefix=<prefix> --stat[=<width>[,<name-width>[,<count>]]] --stdin --submodule[=<format>] --summary --tags[=<pattern>] --text --textconv --topo-order --unified=<n> --until=<date> --walk-reflogs --word-diff-regex=<regex> --word-diff[=<mode>] --ws-error-highlight=<kind>
5 39 Gitは簡単ではない Gitにはコマンドが多い Gitはユニークな設計思想を持つ Gitは使い方の自由度が高い(人によって流儀が異なる) Gitに慣れていないとトラブルへの対処が難しい
6 39 Gitで使われる用語を一通り学ぶ 「コミット」や「ブランチ」など、バージョン管理 システムでは共通の単語が使われるが、ツールに よって意味や用法がかなり異なる 以下の説明はGitでの説明であることに注意
7 39 卒論プロジェクト grad fig ref doc 管理したいファイルやフォルダの集まりを「プロジェクト」と呼ぶ 以後、必要なファイルを全て含むトップレベルフォルダをプロジェクトと同一視する
8 39 リポジトリ ワーキングツリー .git Git管理下にあるプロジェクト Gitで管理されたプロジェクトには.gitというフォルダがある リポジトリ:履歴や状態を保存する場所 ワーキングツリー:作業中のファイルやフォルダ プロジェクト一つにリポジトリ一つ
9 39 .git .git 自分のPC サーバ ローカルリポジトリ リモートリポジトリ (ノンベアリポジトリ) (ベアリポジトリ)
10 39 ローカルリポジトリ (local repository) 手元のPCにあるリポジトリのこと ワーキングツリーを持つ リモートリポジトリ (remote repository)
リモート(ネットワークの向こう側)にある ワーキングツリーを持たない ベアリポジトリ (bare repository) ワーキングツリーを持たないリポジトリ 一般にリモートはベアリポジトリ
11 39 スナップショット(snapshot) ある時点でのプロジェクト全体の状態 Gitにある時点でのスナップショットを登録すること またはそのスナップショットそのもの コミット (commit)
12 39 Gitでは「歴史」を丸と線で表現する • 丸:ある時点の「状態」 • 線:二つの状態の関係(差分) 三日前 二日前 昨日
歴史 昨日から修正を加えたプロジェクト (スナップショット)
13 39 コミット:現在の状態を保存して「歴史」に加える 三日前 二日前 昨日 コミット 歴史 (スナップショット) 昨日から修正を加えたプロジェクト
(スナップショット)
14 39 三日前 二日前 昨日 歴史 今日 この玉それぞれを「コミット」と呼ぶ この玉を新たに作る作業を「コミットする」と呼ぶ commit
(名詞) : Gitの歴史のある「点」(スナップショット) commit (動詞): Gitの歴史に新たにスナップショットを付け加えること https://git-scm.com/docs/gitglossary A Git Glossary
15 39 歴史上の任意の地点に戻ることができる 今日の状態 二日前の状態 今日 昨日 二日前 三日前 今日
昨日 二日前 三日前 ワーキングツリー コミットはセーブファイルのようなもの
16 39 歴史上の任意の地点を比較できる 今日 昨日 二日前 三日前 デバッグに極めて有用
17 39 Gitには三種類の場所がある ワーキングツリー(workingtree) 現在修正中のプロジェクトファイルがある場所 インデックス (index) ステージングをする場所 コミットするスナップショットを用意する リポジトリ
(repository) 歴史(コミット)を保存する場所
18 39 本番環境に反映させる前に準備をする場所 ローカルPCで修正 ステージング環境 本番環境 ローカルPC ここで動作テスト 本番環境へ反映 ステージング環境
ステージング環境に修正を反映すること ステージング
19 39 ワーキングツリー インデックス リポジトリ file1 file2 まだGit管理下に 置かれていない Gitの初期化直後
20 39 ワーキングツリー インデックス リポジトリ file1 file2 ステージング file1 file2
ワーキングツリーの状態(スナップショット)をインデックスに登録
21 39 ワーキングツリー インデックス リポジトリ file1 file2 コミット file1 file2
インデックスにステージングされた状態をリポジトリに登録 file1 file2
22 39 Q: なぜインデックスがあるの? A: 複数の修正がある時、一部の修正 を選んでコミットを作るため
23 39 file1 file2 file1 file2 最後にコミットした状態からfile1とfile2を修正した ワーキングツリー インデックス リポジトリ
file1 file2
24 39 file1 file2 file1 file2 file1だけステージングする ワーキングツリー インデックス リポジトリ
file1 file2
25 39 file1 file2 file1 file2 コミットする ワーキングツリー インデックス リポジトリ
file1 file2
26 39 file1 file2 file1 file2 file2も同様にステージング、コミットする ワーキングツリー インデックス リポジトリ
file1 file2
27 39 file1 file2 file1 file2 file1 file2 こんな歴史ができあがった file1とfile2を追加
file1を修正 file2を修正 Gitでは積極的に歴史を作成、改変する
28 39 Gitでは歴史を積極的に改変する Gitでは歴史が分岐することがある Gitにおいて歴史操作の手段として使うのがブランチ
29 39 初期化直後 最初のコミット main main 次のコミット main さらに次のコミット main
ブランチ (branch) コミットにつくラベルのようなもの デフォルトでmainというブランチが用意される 自由に作ることができる コミットされると一緒に動く
30 39 main branch ブランチ作成直後 main branch HEAD ブランチの切り替え main
branch HEAD コミット HEAD カレントブランチ (current branch) 「今見ているブランチ」のこと HEADというラベルが指す コミットにより動くのはカレントブランチのみ
31 39 main branch branchを 見ている状態 HEAD main branch mainに
切り替える HEAD main branch コミットする HEAD ブランチを切り替えながらコミットをすると 一般に歴史が分岐する
32 39 main HEAD 通常の状態 main HEAD detached HEAD状態 HEADがブランチを経由して
コミットを指している HEADがブランチから外れ コミットを直接指している 通常、HEADはブランチを指しているが、HEADが直接 コミットを指す状態を頭が取れた(detached HEAD)状態 と呼ぶ
33 39 Gitでは、原則としてデフォルトブランチ(main)で作業しない 別のブランチで作業し、作業が一段落したらmainに取り込む この取り込む作業をマージと呼ぶ マージ(merge) あるブランチの修正を、別のブランチに取り込むこと
34 39 main branch mainの スナップショット branchの スナップショット main branch
ファイル追加 mainからbranchへ更新する ための「差分」 玉:スナップショット 線:スナップショット間の差分
35 39 main = + コミット (スナップショット) 修正(パッチ) branch ファイル追加
次のコミット (スナップショット) main branch スナップショット(玉)に、パッチ(線)を適用すると、次のスナップショット(玉)になる
36 39 main branch main branch 修正を取り込みたいブランチが、もう一方のブ ランチの直接の祖先である場合、ブランチを移 動するだけでマージが完了する これをFast-forwardマージ(早送りマージ)と呼ぶ
37 39 main branch main branch 歴史が分岐している場合、マージにより歴史が 合流する HEAD HEAD
新たに作られるコミットをマージコミット(merge commit)と呼ぶ
38 39 main branch main branch Fast Forwardマージできる場合でもマージコミットを作ることができる Fast forwardマージすると、マージ元がどこで分岐したかの情報が失われる
main branch main branch
39 39 コミット(名詞):スナップショット コミット(動詞):スナップショットの登録 インデックス:コミットの前に修正を登録する場所 ステージング:インデックスに修正を登録すること ブランチ:コミットについたラベル マージ:二つのブランチの修正を一つにまとめること Gitの歴史は「丸」と「線」で表現する 「丸」がスナップショット、「線」が差分を表す
今日ここだけは覚えて欲しい