git initの生成物をCommit
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
HEAD
config
description
hooks/
info/
nothing added to commit but untracked files present (use "git add" to track)
git addで何が起きているのか?
$ echo “Hello World” > hello.txt
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello.txt
nothing added to commit but untracked files present (use "git add" to track)
$ git status
$ pwd
/Users/atsuya-sato/Desktop/git-inside-workshop/
$ cd ../
Slide 24
Slide 24 text
git addで何が起きているのか?
$ git add hello.txt
$ cd .git
$ git status -uall
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
index
objects/55/7db03de997c86a4a028e1ebd3a1ceb225be238
nothing added to commit but untracked files present (use "git add" to track)
objects/
55/7db03de997c86a4a028e1ebd3a1ceb225be238
をさらに詳しく見てみる
00000000: 62 6c 6f 62 20 31 32 00 48 65 6c 6c 6f 20 57 6f
00000010: 72 6c 64 0a
b b
l o (Space) 1 2 (NUL) H e l l o W o
r l d (改行)
(Space)
• ASCIIコードと照らし合わせると…
<オブジェクトタイプ> 0x20 <ファイルバイト数> 0x00 <データバイト>
• オブジェクトのフォーマットは
になっている!
先にgit addで出来た.git/の
生成物をコミットしておく
$ cd .git
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
index
objects/55/7db03de997c86a4a028e1ebd3a1ceb225be238
nothing added to commit but untracked files present (use "git add" to track)
$ git status -uall
$ git add .
$ git commit -m “Exec git add hello.txt”
/Users/atsuya-sato/Desktop/git-inside-workshop
$ pwd
Slide 53
Slide 53 text
git commitで何が起きているのか
$ cd ../
/Users/atsuya-sato/Desktop/git-inside-workshop/.git
$ pwd
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: hello.txt
$ git commit -m “Add hello.txt”
[master (root-commit) 87a9891] Add hello.txt
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
Slide 54
Slide 54 text
git commitで何が起きているのか
$ cd .git
$ git status -uall
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index
Untracked files:
(use "git add <file>..." to include in what will be committed)
COMMIT_EDITMSG
logs/HEAD
logs/refs/heads/master
objects/87/a989174c548a6a8b0e78a017d00db3a4e16d12
objects/97/b49d4c943e3715fe30f141cc6f27a8548cee0e
refs/heads/master
no changes added to commit (use "git add" and/or "git commit -a")
Slide 55
Slide 55 text
git commitで何が起きているのか
$ cd .git
$ git status -uall
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index
Untracked files:
(use "git add <file>..." to include in what will be committed)
COMMIT_EDITMSG
logs/HEAD
logs/refs/heads/master
objects/87/a989174c548a6a8b0e78a017d00db3a4e16d12
objects/97/b49d4c943e3715fe30f141cc6f27a8548cee0e
refs/heads/master
no changes added to commit (use "git add" and/or "git commit -a")
たくさんファイル
が出てきた!!
.gitの変更を見る
$ cd .git
$ git status -uall
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: COMMIT_EDITMSG
modified: index
modified: logs/HEAD
modified: logs/refs/heads/master
modified: refs/heads/master
Untracked files:
(use "git add <file>..." to include in what will be committed)
objects/07/41a4a634a5c550e59ed013275ebea2b5bedef6
objects/2d/ccf803893c8e418bdaa03f0c4af005517f8e88
objects/70/2e500c6260d7caaf75f266ac27eb8215108f76
一番上がcommit
オブジェクト