SlideShare a Scribd company logo
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!

More Related Content

What's hot

Calling python from r
Calling python from rCalling python from r
Calling python from r
Barry DeCicco
 
Web Scraping with Python
Web Scraping with PythonWeb Scraping with Python
Web Scraping with Python
Paul Schreiber
 
RejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbRejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rb
Fumihiro Kato
 
Bb health ai_jan26_v2
Bb health ai_jan26_v2Bb health ai_jan26_v2
Bb health ai_jan26_v2
Ben 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 hackers
Pavan M
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010
Christian 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 YQL
Christian Heilmann
 

What's hot (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
 

Viewers also liked

エンジニアのための学ぶ技術
エンジニアのための学ぶ技術エンジニアのための学ぶ技術
エンジニアのための学ぶ技術
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.1
nishio
 
KJ法の実践
KJ法の実践KJ法の実践
KJ法の実践nishio
 
線形?非線形?
線形?非線形?線形?非線形?
線形?非線形?
nishio
 
Long Short-term Memory
Long Short-term MemoryLong Short-term Memory
Long Short-term Memory
nishio
 
勾配降下法の 最適化アルゴリズム
勾配降下法の最適化アルゴリズム勾配降下法の最適化アルゴリズム
勾配降下法の 最適化アルゴリズム
nishio
 

Viewers also liked (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
 
勾配降下法の 最適化アルゴリズム
勾配降下法の最適化アルゴリズム勾配降下法の最適化アルゴリズム
勾配降下法の 最適化アルゴリズム
 

Similar to 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 Master
Nicola 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 iOS
Madhava 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 Git
Daniel 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 better
Jonas De Smet
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginning
James 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 control
Becky 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 Golang
Chris McEniry
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The Basics
Nina Zakharenko
 
How git works
How git works  How git works
How git works
Mohamed Ahmed
 
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
Christian Couder
 
OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022
Ofek 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 2015
Brian Coffey
 
Git Real
Git RealGit Real
Git Real
Gong Haibing
 
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
AlbanLevy
 

Similar to 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
 

More from nishio

量子アニーリングマシンのプログラミング
量子アニーリングマシンのプログラミング量子アニーリングマシンのプログラミング
量子アニーリングマシンのプログラミング
nishio
 
夏プロ報告
夏プロ報告夏プロ報告
夏プロ報告
nishio
 
ITと経営
ITと経営ITと経営
ITと経営
nishio
 
部分観測モンテカルロ計画法を用いたガイスターAI
部分観測モンテカルロ計画法を用いたガイスターAI部分観測モンテカルロ計画法を用いたガイスターAI
部分観測モンテカルロ計画法を用いたガイスターAI
nishio
 
交渉力について
交渉力について交渉力について
交渉力について
nishio
 
If文から機械学習への道
If文から機械学習への道If文から機械学習への道
If文から機械学習への道
nishio
 
組織横断型研究室構想
組織横断型研究室構想組織横断型研究室構想
組織横断型研究室構想
nishio
 
2017首都大学東京情報通信特別講義
2017首都大学東京情報通信特別講義2017首都大学東京情報通信特別講義
2017首都大学東京情報通信特別講義
nishio
 
強化学習その5
強化学習その5強化学習その5
強化学習その5
nishio
 
良いアイデアを出すための方法
良いアイデアを出すための方法良いアイデアを出すための方法
良いアイデアを出すための方法
nishio
 
強化学習その4
強化学習その4強化学習その4
強化学習その4
nishio
 
強化学習その3
強化学習その3強化学習その3
強化学習その3
nishio
 
強化学習その2
強化学習その2強化学習その2
強化学習その2
nishio
 
強化学習その1
強化学習その1強化学習その1
強化学習その1
nishio
 
首都大学東京「情報通信特別講義」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
 

More from 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など)
 
「ネットワークを作る」 ってどういうこと?
「ネットワークを作る」ってどういうこと?「ネットワークを作る」ってどういうこと?
「ネットワークを作る」 ってどういうこと?
 
「ネットワークを作ることで イノベーションを加速」 ってどういうこと?
「ネットワークを作ることでイノベーションを加速」ってどういうこと?「ネットワークを作ることでイノベーションを加速」ってどういうこと?
「ネットワークを作ることで イノベーションを加速」 ってどういうこと?
 

Recently uploaded

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

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!