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
演習:Gitの操作(応用編) / GitHub Practice Advanced
Search
kaityo256
PRO
October 22, 2021
Education
1.6k
2
Share
演習:Gitの操作(応用編) / GitHub Practice Advanced
物理情報工学ソフトウェア開発演習
kaityo256
PRO
October 22, 2021
More Decks by kaityo256
See All by kaityo256
勾配ブースティングと決定木の話 / gradient boosting and decision trees
kaityo256
PRO
5
1.1k
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
この講義について / 00-setup
kaityo256
PRO
2
340
GitHubによるWebアプリケーションのデプロイ / 07-github-deploy
kaityo256
PRO
1
260
演習:Gitの基本操作 / 04-git-basic
kaityo256
PRO
0
460
演習:Gitの応用操作 / 05-git-advanced
kaityo256
PRO
0
270
演習:GitHubの基本操作 / 06-github-basic
kaityo256
PRO
0
290
バージョン管理とは / 01-a-vcs
kaityo256
PRO
1
310
Gitの仕組みと用語 / 01-b-term
kaityo256
PRO
0
320
Other Decks in Education
See All in Education
Gesture-based Interaction - Lecture 6 - Next Generation User Interfaces (4018166FNR)
signer
PRO
1
2.2k
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
signer
PRO
0
2.6k
Multimodal Interaction - Lecture 3 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2.1k
What workforce agencies must have in place to compete for and deliver on RESTART grants
territorium
PRO
0
140
2026年度春学期 統計学 講義の進め方と成績評価について (2026. 4. 9)
akiraasano
PRO
0
140
Measuring what matters
jonoalderson
0
250
事業紹介資料(トレーナー養成講座)
kentaro1981
0
220
We部コミュニティスライド2026-04-24
junhat6
0
130
Google Antigravity エージェント・フ ァーストな開発パラダイムへの招待
mickey_kubo
1
130
小学校5,6年生向けキャリア教育 大人になるまでの道
sat
PRO
8
3.5k
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4019538FNR)
signer
PRO
0
3.1k
Information Architectures - Lecture 2 - Next Generation User Interfaces (4018166FNR)
signer
PRO
1
2k
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
510
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
180
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
How to build a perfect <img>
jonoalderson
1
5.4k
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
380
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
110
Transcript
1 29 演習:Gitの操作(応用編) 慶應義塾大学理工学部物理情報工学科 渡辺 物理情報工学ソフトウェア開発演習
2 29 • git amendによりコミットが変更されることを確認する • git mergeの衝突を解決する • git
rebaseにより歴史を改変する • git rebaseの衝突を解決する • git bisectを使ってみる
3 29 リポジトリのクローン ディレクトリの作成 github cd mkdir github cd github
git clone https://github.com/appi-github/amend-sample.git cd amend-sample ホームディレクトリに移動してから githubディレクトリを作成 github amend-sample ホームディレクトリ Git管理された ディレクトリ ここがカレントディレクトリに
4 29 git log --oneline initial commit updates README.md updates
README.md updaets README.md main HEAD 歴史の確認
5 29 コミットの保存 initial commit updates README.md updates README.md updaets
README.md main HEAD original_main git branch original_main 現在のコミットに別名をつけておく
6 29 コミットメッセージの修正 git commit --amend -m "updates README.md" initial
commit updates README.md updates README.md updaets README.md main HEAD original_main updates README.md
7 29 git log --oneline 歴史の確認 initial commit updates README.md
updates README.md updates README.md main HEAD 修正されていることを確認
8 29 git log --all --graph --oneline 歴史が分岐したことを確認 initial commit
updates README.md updates README.md updaets README.md main HEAD original_main updates README.md
9 29 リポジトリのクローン cd cd github git clone https://github.com/appi-github/merge-sample.git cd
merge-sample github merge-sample ここがカレントディレクトリに
10 29 ブランチの作成 git branch knock origin/knock main HEAD knock
ブランチの確認 git branch -vva main HEAD origin/knock origin/knock origin/knockの指すコミットに knockブランチを作成
11 29 差分確認 main HEAD knock git diff knock poetry.txt
poetry.txt コミット間を比較 ここに差分を検出
12 29 マージ main HEAD knock 衝突 git merge knock
マージの中断 git merge --abort main HEAD knock このプロセスでpoetry.txtが どのように変化したか調べる
13 29 マージ git merge knock main HEAD knock 衝突
衝突の解決とコミット git add poetry.txt git commit -m "knock" potery.txtをエディタで修正
14 29 main HEAD knock git log --all --graph --oneline
マージされた「歴史」を確認
15 29 リポジトリのクローン cd cd github git clone https://github.com/appi-github/rebase-history-sample.git cd
rebase-history-sample github rebase-history-sample ここがカレントディレクトリに
16 29 二人が目を覚ます アイスがまだある アイスが消えた ボブが登校 歴史の確認 git log --oneline
17 29 ブランチの作成 git branch start origin/start 二人が目を覚ます アイスがまだある アイスが消えた
ボブが登校 main HEAD knock 歴史改変の起点にする
18 29 歴史改変 git rebase -i start
19 29 改変された歴史の確認 git log --oneline 二人が目を覚ます アイスがまだある アイスが消えた ボブが登校
20 29 リポジトリのクローン cd cd github git clone https://github.com/appi-github/rebase-conflict-sample cd
rebase-conflict-sample github rebase-conflict-sample ここがカレントディレクトリに
21 29 main HEAD branch origin/branch ブランチの準備 git switch -c
branch origin/branch origin/branchの指すコミットにbranchというブランチを作成し、 カレントブランチをそこへ移動
22 29 歴史の確認 git log --all --graph --oneline main HEAD
branch m1 m2 m3 f1 f2 f3
23 29 リベースの実行 git rebase main main HEAD branch
24 29 main m1 m2 m3 f1 f2 f3 f1’
f2’ f3’ 状態の確認 git status HEAD HEADは「最後にリベースがうまくいったコミット」を指している (detached HEAD)
25 29 main m1 m2 m3 f1 f2 f3 f1’
f2’ f3’ HEAD エディタで衝突状態にあるファイル「text1.txt」を修正し、保存する
26 29 解決をGitに伝える git add text1.txt git commit -m "f2"
main m1 m2 m3 f1 f2 f3 f1’ f2’ f3’ HEAD Gitが自動で作ることができなかった このコミットを手動で作った
27 29 リベースの続行 git rebase --continue main m1 m2 m3
f1’ f2’ f3’ HEAD branch リベースが最後まで実行され、detached HEAD状態が解消される
28 29 歴史の確認 git log --oneline --graph main m1 m2
m3 f1’ f2’ f3’ HEAD branch もともと分岐していた歴史が一本道になり、 mainからbranchへfast-forwardマージが可能になった
29 29 git bisectを使った犯人捜し