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入門
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
uzimaru0000
September 26, 2020
Technology
370
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
git入門
Zli × エキサイト 合同LT
https://zli.connpass.com/event/188279/
uzimaru0000
September 26, 2020
More Decks by uzimaru0000
See All by uzimaru0000
OGPを使いたい
uzimaru0000
0
190
Webフロントエンド入門
uzimaru0000
1
470
WebフロントエンジニアはOSの夢を見る
uzimaru0000
0
370
BrainFuckをつくった
uzimaru0000
0
590
Elmで作るCLI
uzimaru0000
0
150
Blogを作った話 -Zli x DeNA-
uzimaru0000
1
220
Compression Vue App
uzimaru0000
0
140
好きなライブラリ_OSS
uzimaru0000
0
240
Other Decks in Technology
See All in Technology
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
340
シンプルな設定ファイルで実現する AWS IAM Identity Center の ユーザー管理Terraformフレームワークを公開しました / Simplifying AWS IAM Identity Center User Management: An Open-Source Terraform Framework
yamaguchitk333
0
220
CSS2026:OWS研究会・招待講演「世界観を、実装する」
atsush1_sada
2
230
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
4
670
[EMNLP26] RIGEL: Self-Distilled Score Adaptation for Image and Video Captioning Evaluation
keio_smilab
PRO
0
120
生成AI時代、PMは事業責任者に進化するともっと面白い〜PMだからこそ事業構造を動かせる時代に〜
kakehashi
PRO
0
450
VLA-JEPA: Enhancing Vision-Language-Action Models with Latent World Models
takmin
0
160
Browser Spec: Testing Hotwire with Ruby
takahashim
1
160
トークン化預金DCJPYの取り組みと活用ユースケース
finengine
0
230
Rustuna: Rustによる高速なOptuna実装
pfn
PRO
0
220
Classmethod Company Deck
satoshi7
1
820
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
2
390
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
620
Building the Perfect Custom Keyboard
takai
2
910
BBQ
matthewcrist
90
10k
Done Done
chrislema
187
17k
Amusing Abliteration
ianozsvald
1
350
Between Models and Reality
mayunak
4
500
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
30 Presentation Tips
portentint
PRO
1
430
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Transcript
git入門 うじまる
自己紹介 - B4 - うじまる - Webフロントエンド - TypeScript -
Elm - 最近Rustをやってます。 - Twitter - @uzimaru0000 - GitHub - @uzimaru0000
みなさんgitは使ってますか?
使ってますね
ありがとうございました!
終わりません♂
gitの仕組み分かりますか?
gitの仕組み入門 うじまる
もくじ - gitって? - gitの仕組み - `git add` を使わないで `git
add` をしてみる
gitって?
gitって? Git(ギット[2][3][4])は、プログラムのソースコードなどの変更履歴を記録・追跡するための分散型バージョン管理システムである。 (wikipediaより) - 分散型バージョン管理システム - Linux カーネルの開発者のリーナスさんが作ったシステム
gitって? Q. 情報はどこに保存されてる? A. `.git` ディレクトリ以下
gitって? - HEAD - `git push origin HEAD` とかで参照される
- index - いわゆるstaging - objects/ - gitのobjectの保存先 - refs/ - branchとかtagsの保存先
gitって? - HEAD - `git push origin HEAD` とかで参照される
- index - いわゆるstaging - objects/ - gitのobjectの保存先 - refs/ - branchとかtagsの保存先
git-object - gitは3種類のobjectによって構成されている - commit - tree - blob -
それぞれ、commit・ディレクトリ・ファイルに対応している - sha1で固有のIDが割り当てられる - zlibで圧縮されている
git-object フォーマットは以下のような感じ - このobjectのtype - bodyのbytes数 - body(objectのtypeによって中身は変わる)
git-object - commit - 親のcommit, ルートのtree, commitをした人などの情報が記録されている - tree
- ディレクトリの情報が記録されている - 1つ以上のtreeやblobを持っている - blob - ファイルの情報が記録されている - `git add` した時点のファイルのスナップショット ※ git は 差分 ではなく ファイルの中身すべて を保存している
git-object sha1の作られ方 - objectの中身を使う
git-object 結果が違う・・・・ 原因:object fileはzlibで圧縮されている
git-object `zlib_decompress` を使ってファイルを解凍 同じ結果になった!!
git-object - sha1の値がそのままpathになる - 上2桁がディレクトリで残りがファイル名 コンテンツからsha1が生成されるので 同じ内容のものは重複しない!
HEADとrefs/ - HEADには現在のHEADのpathが書いてる - .git/refs/heads/master が今のHEAD(ブランチ)
HEADとrefs/ - HEADの値を使って `refs/` の値を見てみる
gitの仕組み
git-objectの関係性
git-objectの関係性
git-objectの関係性
git addをしてみる
gitのコマンド - git add や git commit などのコマンド - これらは「磁器コマンド」と呼ばれる
- git cat-file や git hash-object などのコマンド - これらは「配管コマンド」と呼ばれる 配管コマンドを組み合わせれば、磁器コマンド相当のことができる!! (昔はそうしていたみたい)
git addをしてみる $ git hash-object - ファイルをblobにするためのコマンド - `-w` オプションをつけることで保存もしてくれる
$ git update-index - indexをupdateしてくれる - optionがちょっと多い
git addをしてみる
DEMO
まとめ - git の仕組みは意外とシンプル - git-objectのパースと配管コマンドの実装が出来たらgitは作れる
None
ありがとうございました!