Just a bit of git
A toy git implementation in rust. This is a work in progress and commands are being added one by one. For a full breakdown of implemented commands and features see the generated cli documentation.
- Learn more about how git works under the hood
- 100% (or as close as possible) compatible with git repositories
- Replace git
- Production usage
Expand generated CLI documatation
This document contains the help content for the bit command-line program.
Command Overview:
bit↴bit init↴bit cat-file↴bit hash-object↴bit log↴bit ls-tree↴bit write-tree↴bit show-ref↴bit tag↴bit rev-parse↴bit ls-files↴bit check-ignore↴bit rm↴bit add↴bit status↴bit commit↴bit read-tree↴bit branch↴bit switch↴bit restore↴
Usage: bit <COMMAND>
init— Initializes a new bit repositorycat-file— Displays the contents of a bit objecthash-object— Creates a bit object from a file on disk, and optionally writes it to the object databaselog— Shows the commit history starting from a given commit (defaulting to HEAD)ls-tree— Displays the contents of a tree objectwrite-tree— Writes the current index to a tree object and prints it's hashshow-ref— Prints the hash and name of passed refs or all refs if none were passedtag— Creates a new tag or lists existing tags if no name is providedrev-parse— Prints the hash of the passed ref or hashls-files— Prints the list of files in the indexcheck-ignore— Checks if the passed path is ignored by .bitignore and prints it if it isrm— Remove a file from the index and delete it from the filesystemadd— Adds a file to the index (creating a blob object for it)status— Shows the current branch, staged changes, unstaged changes and untracked filescommit— Creates a new commit with the current index as the tree, and HEAD as the parentread-tree— Extract the contents of a tree object into the working directorybranch— Creates, lists, deletes, or moves branchesswitch— Switch between branchesrestore— Discards either working or staged changes for the given files
Initializes a new bit repository
Usage: bit init [PATH]
<PATH>
Displays the contents of a bit object
Usage: bit cat-file <TYPE> <OBJECT>
<TYPE><OBJECT>
Creates a bit object from a file on disk, and optionally writes it to the object database
Usage: bit hash-object [OPTIONS] <PATH>
<PATH>
-
-t,--type <TYPE>Default value:
blob -
-w,--write
Shows the commit history starting from a given commit (defaulting to HEAD)
Usage: bit log [COMMIT]
<COMMIT>
Displays the contents of a tree object
Usage: bit ls-tree <HASH>
<HASH>
Writes the current index to a tree object and prints it's hash
Usage: bit write-tree
Prints the hash and name of passed refs or all refs if none were passed
Usage: bit show-ref
Creates a new tag or lists existing tags if no name is provided
Usage: bit tag [OPTIONS] [NAME] [OBJECT]
<NAME><OBJECT>
-a— Create a tag object instead of a lightweight tag. This now also requires a message to be provided-m,--message <MESSAGE>
Prints the hash of the passed ref or hash
Usage: bit rev-parse [HASH_OR_REF]
<HASH_OR_REF>
Prints the list of files in the index
Usage: bit ls-files [OPTIONS]
-v,--verbose— This doesn't exist in actual git but it's useful for inspecting our index
Checks if the passed path is ignored by .bitignore and prints it if it is
Usage: bit check-ignore <PATH>
<PATH>
Remove a file from the index and delete it from the filesystem
Usage: bit rm [OPTIONS] [PATHS]...
<PATHS>
-r
Adds a file to the index (creating a blob object for it)
Usage: bit add [PATHS]...
<PATHS>
Shows the current branch, staged changes, unstaged changes and untracked files
Usage: bit status
Creates a new commit with the current index as the tree, and HEAD as the parent
Usage: bit commit [OPTIONS]
-m,--message <MESSAGE>
Extract the contents of a tree object into the working directory
Usage: bit read-tree [OPTIONS] <TREE>
<TREE>
-u-m
Creates, lists, deletes, or moves branches
Usage: bit branch [OPTIONS] [BRANCH] [SECOND_ARG]
<BRANCH><SECOND_ARG>
--force-d,--delete-m,--move
Switch between branches
Usage: bit switch [OPTIONS] <BRANCH>
<BRANCH>
-c,--create
Discards either working or staged changes for the given files
Usage: bit restore [OPTIONS] [FILES]...
<FILES>
-W,--worktree-C,--staged
This document was generated automatically by
clap-markdown.