git

git server 目錄架構


更新記錄

item note
20150628 第一版

目錄


git init

  • hooks目錄內不會使用.sample檔案
  • objects目錄初始為空,除了pack,info檔案
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
xx/git-example/hello$ git init
xx/git-example/hello/.git/
xx/git-example/hello$ find .
.
./.git
./.git/description
./.git/HEAD
./.git/branches
./.git/info
./.git/info/exclude
./.git/hooks
./.git/hooks/update.sample
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/pre-push.sample
./.git/hooks/commit-msg.sample
./.git/hooks/pre-commit.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/pre-applypatch.sample
./.git/hooks/post-update.sample
./.git/hooks/pre-rebase.sample
./.git/config
./.git/refs
./.git/refs/heads
./.git/refs/tags
./.git/objects
./.git/objects/pack
./.git/objects/info
erwin@erwin-Aspire-4810T:~/game/git-example/hello$

add hello.txt

1
2
3
4
5
6
7
8
9
10
11
12
xx/git-example/hello$ echo "hello world" > hello.txt
xx/git-example/hello$ git add hello.txt

xx/git-example/hello$ find .git/objects
.git/objects
.git/objects/3b
.git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad
.git/objects/pack
.git/objects/info

xx/git-example/hello$ git cat-file -p 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
hello world
  • git ls-files
  • git write-tree : Creates a tree object using the current index
  • 請勿使用git write-tree等低皆指令(此地方為讓使用者了解架構才使用)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
xx/git-example/hello$ git ls-files -s
100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 hello.txt
xx/git-example/hello$ git write-tree
68aba62e560c0ebc3396e8ae9335232cd93a3f60
xx/git-example/hello$ git cat-file -p 68aba62e560c0ebc3396e8ae9335232cd93a3f60
100644 blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad hello.txt

xx/git-example/hello$ find .git/objects
.git/objects
.git/objects/68
.git/objects/68/aba62e560c0ebc3396e8ae9335232cd93a3f60
.git/objects/3b
.git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad
.git/objects/pack
.git/objects/info