mygit init
Tạo .mygit/ (objects, refs, HEAD).
mygit add <file>...
Băm thành blob + đưa vào index DIRC.
mygit reset
Dựng lại index từ HEAD.
mygit status
So HEAD / index / working tree (staged, unstaged, untracked).
mygit branch [-v] [-d|-D] [<name>]
Liệt kê nhánh hiện tại (*), tạo nhánh từ HEAD, hoặc xóa.
mygit checkout [-b] <branch|commit>
Đổi nhánh, tạo nhánh mới rồi chuyển (-b), hoặc detached HEAD với SHA đầy đủ.
mygit hash-object [-w] <file>
Băm 1 file thành blob (-w để ghi ra).
mygit cat-file -p <sha>
In nội dung object (tree in đẹp).
mygit write-tree
Chụp thư mục hiện tại thành tree.
mygit commit-tree <tree> -m <msg> [-p <parent>]
Tạo commit từ tree.
mygit commit -m <msg>
write-tree + commit-tree + cập nhật nhánh.
mygit log
Đi ngược lịch sử từ HEAD.
mygit clone <src> [<dst>]
Đọc HEAD nguồn, dựng lại cây file (đọc được repo git thật). Bỏ dst thì lấy tên thư mục nguồn.
mygit push <remote>
Đẩy nhánh hiện tại (local / ssh / https) qua receive-pack.
mygit worktree add <path> [<branch>]
Gắn thêm working tree, chung objects/refs.
mygit worktree list
Liệt kê main + linked worktrees.
mygit worktree remove <path>
Gỡ linked worktree và metadata.
Mã hóa
MYGIT_KEY
Đặt MYGIT_KEY=<passphrase> để XOR nội dung blob/commit trước khi ghi.
Tên object vẫn tính trên plaintext — khớp git hash-object — nhưng đọc thiếu key ra rác.
$ MYGIT_KEY=hunter2 mygit hash-object -w a.txt $ MYGIT_KEY=hunter2 mygit cat-file -p <sha> hello $ mygit cat-file -p <sha> # binary garbage without the key