.git
这是我在 github 上的一个测试仓。
这是仓的详细信息。
先克隆到本地。
git branch
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55)
$ git branch
i22
i33
* i55
i88
i99
ixx
iyy
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55)
$ git branch -r
origin/HEAD -> origin/i22
origin/i22
origin/i33
origin/i44
origin/i55
origin/i66
origin/i77
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55)
$ git branch -a
i22
i33
* i55
i88
i99
ixx
iyy
remotes/origin/HEAD -> origin/i22
remotes/origin/i22
remotes/origin/i33
remotes/origin/i44
remotes/origin/i55
remotes/origin/i66
remotes/origin/i77
git remote
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55) $ git remote origin zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55) $ git remote -v origin https://github.com/factsbenchmarks/test.git (fetch) origin https://github.com/factsbenchmarks/test.git (push) zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55) $ git remote show origin * remote origin Fetch URL: https://github.com/factsbenchmarks/test.git Push URL: https://github.com/factsbenchmarks/test.git HEAD branch: i22 Remote branches: i22 tracked i33 tracked i44 tracked i55 tracked i66 tracked i77 tracked Local branch configured for 'git pull': i22 merges with remote i22 Local refs configured for 'git push': i22 pushes to i22 (up to date) i33 pushes to i33 (up to date) i55 pushes to i55 (up to date) zuo@DESKTOP-QN47U5R MINGW64 /d/a/test (i55) $ git branch i22 i33 * i55 i88 i99 ixx iyy
.git 的目录结构
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ pwd /d/a/test/.git zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ ll total 20 -rw-r--r-- 1 zuo 197609 6 9月 1 21:56 COMMIT_EDITMSG -rw-r--r-- 1 zuo 197609 300 9月 1 22:01 config -rw-r--r-- 1 zuo 197609 73 9月 1 21:51 description -rw-r--r-- 1 zuo 197609 98 9月 1 22:03 FETCH_HEAD -rw-r--r-- 1 zuo 197609 20 9月 1 22:04 HEAD drwxr-xr-x 1 zuo 197609 0 9月 1 21:51 hooks/ -rw-r--r-- 1 zuo 197609 137 9月 1 22:04 index drwxr-xr-x 1 zuo 197609 0 9月 1 21:51 info/ drwxr-xr-x 1 zuo 197609 0 9月 1 21:51 logs/ drwxr-xr-x 1 zuo 197609 0 9月 1 21:58 objects/ -rw-r--r-- 1 zuo 197609 41 9月 1 22:04 ORIG_HEAD -rw-r--r-- 1 zuo 197609 436 9月 1 21:51 packed-refs drwxr-xr-x 1 zuo 197609 0 9月 1 21:51 refs/
.git/COMMIT_EDITMSG
我本地切换到 i44分支,提交过一次commit,-m 跟着的就是 test2
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!)
$ cat COMMIT_EDITMSG
test2
.git/config
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ cat config [core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [remote "origin"] url = https://github.com/factsbenchmarks/test.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "i22"] remote = origin merge = refs/heads/i22
解释:filemode:当设为True时,即便文件内容没有变化,文件 chmod 权限改动,git status 也会飘红。 设为 False后,上述情况不会发生。
.git/description
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ cat description Unnamed repository; edit this file 'description' to name the repository.
.git/FETCH_HEAD
之前的操作是
git checkout i55
git fetch origin i55
git rebase origin/i55
这三步走完后,本地的 i55 分支 和 远程的 i55 分支同步一样了,之前是不一样的。
$ cat FETCH_HEAD e28d3981403651641e1e7704a401a40f3bb4cc6b branch 'i55' of https://github.com/factsbenchmarks/test
.git/HEAD
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ cat HEAD ref: refs/heads/i55
.git/hooks
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ cd hooks/ zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/hooks (GIT_DIR!) $ ll total 36 -rwxr-xr-x 1 zuo 197609 478 9月 1 21:51 applypatch-msg.sample* -rwxr-xr-x 1 zuo 197609 896 9月 1 21:51 commit-msg.sample* -rwxr-xr-x 1 zuo 197609 3327 9月 1 21:51 fsmonitor-watchman.sample* -rwxr-xr-x 1 zuo 197609 189 9月 1 21:51 post-update.sample* -rwxr-xr-x 1 zuo 197609 424 9月 1 21:51 pre-applypatch.sample* -rwxr-xr-x 1 zuo 197609 1638 9月 1 21:51 pre-commit.sample* -rwxr-xr-x 1 zuo 197609 1492 9月 1 21:51 prepare-commit-msg.sample* -rwxr-xr-x 1 zuo 197609 1348 9月 1 21:51 pre-push.sample* -rwxr-xr-x 1 zuo 197609 4898 9月 1 21:51 pre-rebase.sample* -rwxr-xr-x 1 zuo 197609 544 9月 1 21:51 pre-receive.sample* -rwxr-xr-x 1 zuo 197609 3610 9月 1 21:51 update.sample*
.git/index
乱码
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ cat index DIRC[▒▒7 u▒X[▒▒7 u▒X▒▒ĜUnG▒&▒h▒▒Ukpb▒▒Dt.txtTREE1 0 ▒p_%▒▒:}▒▒c%8▒▒/bH▒7▒j▒C▒▒▒b▒ ▒ ▒
.git/ORIG_HEAD
作为备份指向危险操作前的HEAD,不知道干啥
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!)
$ cat ORIG_HEAD
071b8658e7471dd5a69952626479ae3a0442a84f
.git / packed-refs
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git (GIT_DIR!) $ cat packed-refs # pack-refs with: peeled fully-peeled sorted 071b8658e7471dd5a69952626479ae3a0442a84f refs/remotes/origin/i22 071b8658e7471dd5a69952626479ae3a0442a84f refs/remotes/origin/i33 f4b4b839ba58db53aea6b1fc5561a89924a7711c refs/remotes/origin/i44 e28d3981403651641e1e7704a401a40f3bb4cc6b refs/remotes/origin/i55 bb060622eeea8b0cb98403d65105e47423300429 refs/remotes/origin/i66 ed9231756d20881077a27e98de7119da87b87902 refs/remotes/origin/i77
.git/refs
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs (GIT_DIR!) $ pwd /d/a/test/.git/refs zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs (GIT_DIR!) $ ll total 4 drwxr-xr-x 1 zuo 197609 0 9月 1 22:04 heads/ drwxr-xr-x 1 zuo 197609 0 9月 1 21:51 remotes/ drwxr-xr-x 1 zuo 197609 0 9月 1 21:51 tags/
.git/refs/heads
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs (GIT_DIR!) $ cd heads/ zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/heads (GIT_DIR!) $ ll total 7 -rw-r--r-- 1 zuo 197609 41 9月 1 21:51 i22 -rw-r--r-- 1 zuo 197609 41 9月 1 22:01 i33 -rw-r--r-- 1 zuo 197609 41 9月 1 22:04 i55 -rw-r--r-- 1 zuo 197609 41 9月 1 21:51 i88 -rw-r--r-- 1 zuo 197609 41 9月 1 21:51 i99 -rw-r--r-- 1 zuo 197609 41 9月 1 21:51 ixx -rw-r--r-- 1 zuo 197609 41 9月 1 21:51 iyy
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/heads (GIT_DIR!) $ cat i22 071b8658e7471dd5a69952626479ae3a0442a84f zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/heads (GIT_DIR!) $ cat iyy 071b8658e7471dd5a69952626479ae3a0442a84f zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/heads (GIT_DIR!) $ cat i55 e28d3981403651641e1e7704a401a40f3bb4cc6b
.git/refs/remotes
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs (GIT_DIR!) $ cd remotes/ zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/remotes (GIT_DIR!) $ ll total 0 drwxr-xr-x 1 zuo 197609 0 9月 1 21:56 origin/ zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/remotes (GIT_DIR!) $ cd origin/ zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/remotes/origin (GIT_DIR!) $ ll total 2 -rw-r--r-- 1 zuo 197609 29 9月 1 21:51 HEAD -rw-r--r-- 1 zuo 197609 41 9月 1 21:56 i44 zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/remotes/origin (GIT_DIR!) $ cat HEAD ref: refs/remotes/origin/i22 zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/remotes/origin (GIT_DIR!) $ cat i44 31ba15170fb757f895a2e15ee35383acc8acd3e8
注意:我本地切换到 i44 分支,commit 一次。commit id 就是 :
31ba15170fb757f895a2e15ee35383acc8acd3e8
.git/refs/tags
zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs (GIT_DIR!) $ cd tags/ zuo@DESKTOP-QN47U5R MINGW64 /d/a/test/.git/refs/tags (GIT_DIR!) $ ll total 0