SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
Dive into .git
          2012-05-24
     Dr. NISHIO Hirokazu
http://www.nishiohirokazu.org/
about

• This slide was made for 10 minutes demo. in a tech
  meeting of my company.

• When you print it, put 16 slides per a page will be
  good enough.

• This slide was published under CC-BY 3.0 License.
  You don’t need my permission to share it.
“Git is difficult!”

• “A lot of difficult concepts!”
• OK, put aside those concepts and
  look actually what is going on with Git!

• I hope this demonstration helps you draw picture of
  Git in your mind.
Make a repository
$ mkdir test    No tricks, no gimmicks!
$ cd test       Just an empty directory.
$ ls -a
.    ..

$ git init
Initialized empty Git repository
in .../test/.git/ ←You got it!

               “$ git init test” works same
$ ls -a
.    ..   .git

                 Here is your repository!
Let’s look into it!
$ cd .git
$ tree
.
|-- HEAD
|-- config
|-- description
|-- hooks
|-- info
|   `-- exclude
|-- objects
|   |-- info
|   `-- pack
`-- refs
    |-- heads
    `-- tags          (hooks is omitted)
What is changed
       when you committed?

$ cd ..
$ touch README
$ git add README
$ git commit -m “initial commit”
[master (root-commit) 4dd66d3]
initial commit
You got 3 objects!
$ tree .git/objects
.git/objects
|-- 4d
|   `-- d66d3a32a66f3578317717ccfb18
|-- 54
|   `-- 3b9bebdc6bd5c4b22136034a95dd
|-- e6
|   `-- 9de29bb2d1d6434b8b29ae775ad8
|-- info
`-- pack
                     Last of filename is omitted.
        Some changes outside of objects are omitted
Look into the objects!
       Make show.py:
$ cat > show.py
#!/usr/bin/env python
import sys
import zlib

data = file(sys.argv[1], "rb").read()
data = zlib.decompress(data)
print repr(data)

          Don’t forget chmod +x
In commit obj
$ ./show.py .git/objects/4d/d6...
'commit 201x00
tree 543b...n
author NISHIO Hirokazu <...> 1337655529 +0900n
committer NISHIO Hirokazu <...> 1337655529 +0900n
n
initial commitn'


                Its filename was shown when you committed.
                             I broke lines for readability.
                                   Notice on “tree 543b”
In tree obj
$ ./show.py 54/3b...
'tree 34x00
100644 READMEx00
xe6x9dxe2x9b...'


                        I broke lines.
                       Notice on e69b
In blob obj


$ ./show.py e6/9d...
'blob 0x00'
               It is content of README.
           It is empty now, thus size=0
              and nothing are after x00
Filename of objects

$ python -c “import hashlib;
hashlib.sha1('blob 0x00').hexdigest()”
'e69de29b...'

  It is sha1 hash of its content!
Conclusion

• Repository is in .git
• There are many objects in .git/objects/
• Their contents are compressed with zlib and their
  filenames are sha1 hash of uncompressed contents.

• They are commit obj, tree obj and blob obj.
• Today I omitted on tags and refs (next time?)
Let’s try!

• Edit README and look changes!
• New commit obj has “parent <hash>” line
• New blob has new content of README
• Add new files and look changes in tree obj
• When you add lines on README, does blob have
  whether diff or total content?
Appendix


• Q: Why don’t you use
  “git show --format=raw”

• A: Because it doesn’t show important information.
In tree obj...
$ git show --format=raw 543b
tree 543b

README
         Oh, how can I know its
          contents is in e69d?

          That’s why I need to make show.py
Appendix

• Q: Why don’t you use gunzip to extract it?
• A: It is compressed with zlib, however it is now a
  valid zip-file (it doesn’t have headers)

• If you know easier way, please tell me!

Contenu connexe

Tendances

Calling python from r
Calling python from rCalling python from r
Calling python from rBarry DeCicco
 
Web Scraping with Python
Web Scraping with PythonWeb Scraping with Python
Web Scraping with PythonPaul Schreiber
 
RejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbRejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbFumihiro Kato
 
Bb health ai_jan26_v2
Bb health ai_jan26_v2Bb health ai_jan26_v2
Bb health ai_jan26_v2Ben Busby
 
Conquering the command line for code hackers
Conquering the command line for code hackersConquering the command line for code hackers
Conquering the command line for code hackersPavan M
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Christian Heilmann
 
How to train your python: iterables (FR)
How to train your python: iterables (FR)How to train your python: iterables (FR)
How to train your python: iterables (FR)Jordi Riera
 
Ride the Snake: reddit keynote @ PyCon 09
Ride the Snake: reddit keynote @ PyCon 09Ride the Snake: reddit keynote @ PyCon 09
Ride the Snake: reddit keynote @ PyCon 09Alexis Ohanian
 
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQLOpen Hack London - Introduction to YQL
Open Hack London - Introduction to YQLChristian Heilmann
 

Tendances (11)

Per beginners2
Per beginners2Per beginners2
Per beginners2
 
Calling python from r
Calling python from rCalling python from r
Calling python from r
 
Web Scraping with Python
Web Scraping with PythonWeb Scraping with Python
Web Scraping with Python
 
RejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbRejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rb
 
Bb health ai_jan26_v2
Bb health ai_jan26_v2Bb health ai_jan26_v2
Bb health ai_jan26_v2
 
Objective-c memory
Objective-c memoryObjective-c memory
Objective-c memory
 
Conquering the command line for code hackers
Conquering the command line for code hackersConquering the command line for code hackers
Conquering the command line for code hackers
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010
 
How to train your python: iterables (FR)
How to train your python: iterables (FR)How to train your python: iterables (FR)
How to train your python: iterables (FR)
 
Ride the Snake: reddit keynote @ PyCon 09
Ride the Snake: reddit keynote @ PyCon 09Ride the Snake: reddit keynote @ PyCon 09
Ride the Snake: reddit keynote @ PyCon 09
 
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQLOpen Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
 

En vedette

エンジニアのための学ぶ技術
エンジニアのための学ぶ技術エンジニアのための学ぶ技術
エンジニアのための学ぶ技術nishio
 
クリーンスペース体験記
クリーンスペース体験記クリーンスペース体験記
クリーンスペース体験記nishio
 
Dive into .git 日本語版
Dive into .git 日本語版Dive into .git 日本語版
Dive into .git 日本語版nishio
 
般若心経
般若心経般若心経
般若心経nishio
 
般若心経
般若心経般若心経
般若心経nishio
 
読む技術
読む技術読む技術
読む技術nishio
 
テストとデバッグ
テストとデバッグテストとデバッグ
テストとデバッグnishio
 
モジュールとはなにか?
モジュールとはなにか?モジュールとはなにか?
モジュールとはなにか?nishio
 
カイ2乗分布について
カイ2乗分布についてカイ2乗分布について
カイ2乗分布についてnishio
 
KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版
KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版
KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版nishio
 
数学的帰納法は帰納ではない?
数学的帰納法は帰納ではない?数学的帰納法は帰納ではない?
数学的帰納法は帰納ではない?nishio
 
ZDD入門-お姉さんを救う方法
ZDD入門-お姉さんを救う方法ZDD入門-お姉さんを救う方法
ZDD入門-お姉さんを救う方法nishio
 
Wifiで位置推定
Wifiで位置推定Wifiで位置推定
Wifiで位置推定nishio
 
機械学習キャンバス0.1
機械学習キャンバス0.1機械学習キャンバス0.1
機械学習キャンバス0.1nishio
 
KJ法の実践
KJ法の実践KJ法の実践
KJ法の実践nishio
 
線形?非線形?
線形?非線形?線形?非線形?
線形?非線形?nishio
 
Long Short-term Memory
Long Short-term MemoryLong Short-term Memory
Long Short-term Memorynishio
 
勾配降下法の 最適化アルゴリズム
勾配降下法の最適化アルゴリズム勾配降下法の最適化アルゴリズム
勾配降下法の 最適化アルゴリズムnishio
 

En vedette (18)

エンジニアのための学ぶ技術
エンジニアのための学ぶ技術エンジニアのための学ぶ技術
エンジニアのための学ぶ技術
 
クリーンスペース体験記
クリーンスペース体験記クリーンスペース体験記
クリーンスペース体験記
 
Dive into .git 日本語版
Dive into .git 日本語版Dive into .git 日本語版
Dive into .git 日本語版
 
般若心経
般若心経般若心経
般若心経
 
般若心経
般若心経般若心経
般若心経
 
読む技術
読む技術読む技術
読む技術
 
テストとデバッグ
テストとデバッグテストとデバッグ
テストとデバッグ
 
モジュールとはなにか?
モジュールとはなにか?モジュールとはなにか?
モジュールとはなにか?
 
カイ2乗分布について
カイ2乗分布についてカイ2乗分布について
カイ2乗分布について
 
KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版
KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版
KJ法のW型問題解決モデルとU理論、それぞれの問題意識 加筆版
 
数学的帰納法は帰納ではない?
数学的帰納法は帰納ではない?数学的帰納法は帰納ではない?
数学的帰納法は帰納ではない?
 
ZDD入門-お姉さんを救う方法
ZDD入門-お姉さんを救う方法ZDD入門-お姉さんを救う方法
ZDD入門-お姉さんを救う方法
 
Wifiで位置推定
Wifiで位置推定Wifiで位置推定
Wifiで位置推定
 
機械学習キャンバス0.1
機械学習キャンバス0.1機械学習キャンバス0.1
機械学習キャンバス0.1
 
KJ法の実践
KJ法の実践KJ法の実践
KJ法の実践
 
線形?非線形?
線形?非線形?線形?非線形?
線形?非線形?
 
Long Short-term Memory
Long Short-term MemoryLong Short-term Memory
Long Short-term Memory
 
勾配降下法の 最適化アルゴリズム
勾配降下法の最適化アルゴリズム勾配降下法の最適化アルゴリズム
勾配降下法の 最適化アルゴリズム
 

Similaire à Dive into .git

Do you really understand Git?
Do you really understand Git?Do you really understand Git?
Do you really understand Git?ESUG
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Mandi Walls
 
Ninja Git: Save Your Master
Ninja Git: Save Your MasterNinja Git: Save Your Master
Ninja Git: Save Your MasterNicola Paolucci
 
Giving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOSGiving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOSMadhava Jay
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Controlmobiledevnj
 
Six3 Getting Git
Six3 Getting GitSix3 Getting Git
Six3 Getting GitDaniel Cox
 
Git - Some tips to do it better
Git - Some tips to do it betterGit - Some tips to do it better
Git - Some tips to do it betterJonas De Smet
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginningJames Aylett
 
Introduction of Git
Introduction of GitIntroduction of Git
Introduction of GitWayne Chen
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangChris McEniry
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The BasicsNina Zakharenko
 
New Views on your History with git replace
New Views on your History with git replaceNew Views on your History with git replace
New Views on your History with git replaceChristian Couder
 
OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022Ofek Shilon
 
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Mandi Walls
 
D3 in Jupyter : PyData NYC 2015
D3 in Jupyter : PyData NYC 2015D3 in Jupyter : PyData NYC 2015
D3 in Jupyter : PyData NYC 2015Brian Coffey
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemAlbanLevy
 

Similaire à Dive into .git (20)

Do you really understand Git?
Do you really understand Git?Do you really understand Git?
Do you really understand Git?
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 
Ninja Git: Save Your Master
Ninja Git: Save Your MasterNinja Git: Save Your Master
Ninja Git: Save Your Master
 
Giving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOSGiving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOS
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Control
 
Six3 Getting Git
Six3 Getting GitSix3 Getting Git
Six3 Getting Git
 
Git - Some tips to do it better
Git - Some tips to do it betterGit - Some tips to do it better
Git - Some tips to do it better
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginning
 
Introduction of Git
Introduction of GitIntroduction of Git
Introduction of Git
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with Golang
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The Basics
 
How git works
How git works  How git works
How git works
 
New Views on your History with git replace
New Views on your History with git replaceNew Views on your History with git replace
New Views on your History with git replace
 
OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022
 
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
 
D3 in Jupyter : PyData NYC 2015
D3 in Jupyter : PyData NYC 2015D3 in Jupyter : PyData NYC 2015
D3 in Jupyter : PyData NYC 2015
 
Git Real
Git RealGit Real
Git Real
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control system
 
slides.pdf
slides.pdfslides.pdf
slides.pdf
 

Plus de nishio

量子アニーリングマシンのプログラミング
量子アニーリングマシンのプログラミング量子アニーリングマシンのプログラミング
量子アニーリングマシンのプログラミングnishio
 
夏プロ報告
夏プロ報告夏プロ報告
夏プロ報告nishio
 
ITと経営
ITと経営ITと経営
ITと経営nishio
 
部分観測モンテカルロ計画法を用いたガイスターAI
部分観測モンテカルロ計画法を用いたガイスターAI部分観測モンテカルロ計画法を用いたガイスターAI
部分観測モンテカルロ計画法を用いたガイスターAInishio
 
交渉力について
交渉力について交渉力について
交渉力についてnishio
 
If文から機械学習への道
If文から機械学習への道If文から機械学習への道
If文から機械学習への道nishio
 
組織横断型研究室構想
組織横断型研究室構想組織横断型研究室構想
組織横断型研究室構想nishio
 
2017首都大学東京情報通信特別講義
2017首都大学東京情報通信特別講義2017首都大学東京情報通信特別講義
2017首都大学東京情報通信特別講義nishio
 
強化学習その5
強化学習その5強化学習その5
強化学習その5nishio
 
良いアイデアを出すための方法
良いアイデアを出すための方法良いアイデアを出すための方法
良いアイデアを出すための方法nishio
 
強化学習その4
強化学習その4強化学習その4
強化学習その4nishio
 
強化学習その3
強化学習その3強化学習その3
強化学習その3nishio
 
強化学習その2
強化学習その2強化学習その2
強化学習その2nishio
 
強化学習その1
強化学習その1強化学習その1
強化学習その1nishio
 
首都大学東京「情報通信特別講義」2016年西尾担当分
首都大学東京「情報通信特別講義」2016年西尾担当分首都大学東京「情報通信特別講義」2016年西尾担当分
首都大学東京「情報通信特別講義」2016年西尾担当分nishio
 
ESP8266EXで位置推定
ESP8266EXで位置推定ESP8266EXで位置推定
ESP8266EXで位置推定nishio
 
Raspberry Piで Wifiルータを作る
Raspberry PiでWifiルータを作るRaspberry PiでWifiルータを作る
Raspberry Piで Wifiルータを作るnishio
 
Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)
Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)
Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)nishio
 
「ネットワークを作る」 ってどういうこと?
「ネットワークを作る」ってどういうこと?「ネットワークを作る」ってどういうこと?
「ネットワークを作る」 ってどういうこと?nishio
 
「ネットワークを作ることで イノベーションを加速」 ってどういうこと?
「ネットワークを作ることでイノベーションを加速」ってどういうこと?「ネットワークを作ることでイノベーションを加速」ってどういうこと?
「ネットワークを作ることで イノベーションを加速」 ってどういうこと?nishio
 

Plus de nishio (20)

量子アニーリングマシンのプログラミング
量子アニーリングマシンのプログラミング量子アニーリングマシンのプログラミング
量子アニーリングマシンのプログラミング
 
夏プロ報告
夏プロ報告夏プロ報告
夏プロ報告
 
ITと経営
ITと経営ITと経営
ITと経営
 
部分観測モンテカルロ計画法を用いたガイスターAI
部分観測モンテカルロ計画法を用いたガイスターAI部分観測モンテカルロ計画法を用いたガイスターAI
部分観測モンテカルロ計画法を用いたガイスターAI
 
交渉力について
交渉力について交渉力について
交渉力について
 
If文から機械学習への道
If文から機械学習への道If文から機械学習への道
If文から機械学習への道
 
組織横断型研究室構想
組織横断型研究室構想組織横断型研究室構想
組織横断型研究室構想
 
2017首都大学東京情報通信特別講義
2017首都大学東京情報通信特別講義2017首都大学東京情報通信特別講義
2017首都大学東京情報通信特別講義
 
強化学習その5
強化学習その5強化学習その5
強化学習その5
 
良いアイデアを出すための方法
良いアイデアを出すための方法良いアイデアを出すための方法
良いアイデアを出すための方法
 
強化学習その4
強化学習その4強化学習その4
強化学習その4
 
強化学習その3
強化学習その3強化学習その3
強化学習その3
 
強化学習その2
強化学習その2強化学習その2
強化学習その2
 
強化学習その1
強化学習その1強化学習その1
強化学習その1
 
首都大学東京「情報通信特別講義」2016年西尾担当分
首都大学東京「情報通信特別講義」2016年西尾担当分首都大学東京「情報通信特別講義」2016年西尾担当分
首都大学東京「情報通信特別講義」2016年西尾担当分
 
ESP8266EXで位置推定
ESP8266EXで位置推定ESP8266EXで位置推定
ESP8266EXで位置推定
 
Raspberry Piで Wifiルータを作る
Raspberry PiでWifiルータを作るRaspberry PiでWifiルータを作る
Raspberry Piで Wifiルータを作る
 
Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)
Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)
Wifiにつながるデバイス(ESP8266EX, ESP-WROOM-02, ESPr Developerなど)
 
「ネットワークを作る」 ってどういうこと?
「ネットワークを作る」ってどういうこと?「ネットワークを作る」ってどういうこと?
「ネットワークを作る」 ってどういうこと?
 
「ネットワークを作ることで イノベーションを加速」 ってどういうこと?
「ネットワークを作ることでイノベーションを加速」ってどういうこと?「ネットワークを作ることでイノベーションを加速」ってどういうこと?
「ネットワークを作ることで イノベーションを加速」 ってどういうこと?
 

Dernier

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Dernier (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Dive into .git

  • 1. Dive into .git 2012-05-24 Dr. NISHIO Hirokazu http://www.nishiohirokazu.org/
  • 2. about • This slide was made for 10 minutes demo. in a tech meeting of my company. • When you print it, put 16 slides per a page will be good enough. • This slide was published under CC-BY 3.0 License. You don’t need my permission to share it.
  • 3. “Git is difficult!” • “A lot of difficult concepts!” • OK, put aside those concepts and look actually what is going on with Git! • I hope this demonstration helps you draw picture of Git in your mind.
  • 4. Make a repository $ mkdir test No tricks, no gimmicks! $ cd test Just an empty directory. $ ls -a . .. $ git init Initialized empty Git repository in .../test/.git/ ←You got it! “$ git init test” works same
  • 5. $ ls -a . .. .git Here is your repository!
  • 6. Let’s look into it! $ cd .git $ tree . |-- HEAD |-- config |-- description |-- hooks |-- info | `-- exclude |-- objects | |-- info | `-- pack `-- refs |-- heads `-- tags (hooks is omitted)
  • 7. What is changed when you committed? $ cd .. $ touch README $ git add README $ git commit -m “initial commit” [master (root-commit) 4dd66d3] initial commit
  • 8. You got 3 objects! $ tree .git/objects .git/objects |-- 4d | `-- d66d3a32a66f3578317717ccfb18 |-- 54 | `-- 3b9bebdc6bd5c4b22136034a95dd |-- e6 | `-- 9de29bb2d1d6434b8b29ae775ad8 |-- info `-- pack Last of filename is omitted. Some changes outside of objects are omitted
  • 9. Look into the objects! Make show.py: $ cat > show.py #!/usr/bin/env python import sys import zlib data = file(sys.argv[1], "rb").read() data = zlib.decompress(data) print repr(data) Don’t forget chmod +x
  • 10. In commit obj $ ./show.py .git/objects/4d/d6... 'commit 201x00 tree 543b...n author NISHIO Hirokazu <...> 1337655529 +0900n committer NISHIO Hirokazu <...> 1337655529 +0900n n initial commitn' Its filename was shown when you committed. I broke lines for readability. Notice on “tree 543b”
  • 11. In tree obj $ ./show.py 54/3b... 'tree 34x00 100644 READMEx00 xe6x9dxe2x9b...' I broke lines. Notice on e69b
  • 12. In blob obj $ ./show.py e6/9d... 'blob 0x00' It is content of README. It is empty now, thus size=0 and nothing are after x00
  • 13. Filename of objects $ python -c “import hashlib; hashlib.sha1('blob 0x00').hexdigest()” 'e69de29b...' It is sha1 hash of its content!
  • 14. Conclusion • Repository is in .git • There are many objects in .git/objects/ • Their contents are compressed with zlib and their filenames are sha1 hash of uncompressed contents. • They are commit obj, tree obj and blob obj. • Today I omitted on tags and refs (next time?)
  • 15. Let’s try! • Edit README and look changes! • New commit obj has “parent <hash>” line • New blob has new content of README • Add new files and look changes in tree obj • When you add lines on README, does blob have whether diff or total content?
  • 16.
  • 17. Appendix • Q: Why don’t you use “git show --format=raw” • A: Because it doesn’t show important information.
  • 18. In tree obj... $ git show --format=raw 543b tree 543b README Oh, how can I know its contents is in e69d? That’s why I need to make show.py
  • 19. Appendix • Q: Why don’t you use gunzip to extract it? • A: It is compressed with zlib, however it is now a valid zip-file (it doesn’t have headers) • If you know easier way, please tell me!