{"id":19458333,"url":"https://github.com/longtian/git-internals","last_synced_at":"2025-04-25T05:31:40.107Z","repository":{"id":82330383,"uuid":"83296501","full_name":"longtian/git-internals","owner":"longtian","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-01T13:02:16.000Z","size":163,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T13:37:19.606Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/longtian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-27T10:13:12.000Z","updated_at":"2023-08-21T08:04:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"af7f280f-a4c5-4f0c-abc6-346cc5e17dcf","html_url":"https://github.com/longtian/git-internals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longtian%2Fgit-internals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longtian%2Fgit-internals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longtian%2Fgit-internals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longtian%2Fgit-internals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longtian","download_url":"https://codeload.github.com/longtian/git-internals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250760935,"owners_count":21482899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git"],"created_at":"2024-11-10T17:26:30.970Z","updated_at":"2025-04-25T05:31:40.102Z","avatar_url":"https://github.com/longtian.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-internals\n\n看到颜大大写的[这篇文章](http://yanhaijing.com/git/2017/02/08/deep-git-3/)，很受启发。\n然后我自己去读了一遍 Git 文档的[第 10 章](https://git-scm.com/book/zh/v2)和\n[这个视频](https://www.youtube.com/watch?v=dBSHLb1B8sw)，顺便写了一个工具，\n来辅助理解文中的各种概念。\n\n## 功能\n\n这个工具能够把 `.git` 下的一些关键文件、目录、配置等一起显示到浏览器里，这样就不需要每次去使用不同的命令查看不同文件内容。 \n\n## 环境依赖\n\n- Linux 或者 Mac，且安装了 `git`,`tree`,`node` 命令行工具\n\n## 使用说明\n\n建一个全新的 Git 仓库：\n\n```sh\nmkdir -p /tmp/src\ncd /tmp/src\ngit init\n```  \n\n切换到本项目的目录，通过 `REPO_FOLDER` 环境变量指定本地代码仓库的地址，启动 `express` 服务器:\n\n```\nnpm install\nREPO_FOLDER=/tmp/src node server.js\n```\n\n通过浏览器打开:\n\n```\nhttp://localhost:3000/\n```\n\n回到 `/tmp/src` 目录执行各种 Git 命令，每次执行完命令可以刷新浏览器，查看文件系统的变化。\n\n![](./docs/screenshot.png)\n\n## 注意\n\n- 如果 Git 的全局配置打开了 `GPG Sign` 可能会让提交的原始文件很长, 可使用 `git config commit.gpgsign false` 临时关闭\n- 尽量不要执行 `git gc`，不然就看不到 `loose objects` 的详细记录了\n- 因为会调用 `execSync` 但是没有考虑防范命令行注入攻击什么的，所以请在安全的网络环境下实验\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongtian%2Fgit-internals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongtian%2Fgit-internals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongtian%2Fgit-internals/lists"}