The simple content tracker as git does, helping you practise a new programming language
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Helping you practise a new programming language


It is difficult to master a language by practising small examples from documentation page, systematic practice is needed.

We hope to provide a good project, Dit - the simple content tracker as Git does, to get you off the ground and master a new programming language as quickly as possible.


  • From the love of Git and worship of Linus.
  • "Do it together", hope more guys participate in.
  • Learn more about Git.
  • More practice when come to learning a new programming language.

Implemented version

Dit has already been implemented by below programming languages:

Dit - The simple content tracker as Git does

Dit repository

Dit only implements minimal repository as below:

├── HEAD
├── index
├── objects
└── refs
    └── heads
        └── master

3 directories, 3 files

Dit objects

Dit is a content-addressable filesystem. It has three objects: blob, tree and commit. Each object is named with a 40-character checksum hash and stored under objects folder. The subdirectory is named with the first 2 characters of the SHA-1, and the filename is the remaining 38 characters.

Stored content includes object type + size + \0 + actual content, Dit compresses the content with zlib.

Sha1 can be calculated like below:

# git
$ echo dit | git hash-object --stdin

# shasum
$ echo -e "blob 4\0dit" | shasum
8f2c96ad676d7423d2c319fffb78cfb87c78c3e2  -

# openssl sha1
$ echo -e "blob 4\0dit" | openssl sha1
(stdin)= 8f2c96ad676d7423d2c319fffb78cfb87c78c3e2

# go
fmt.Printf("%x\n", sha1.Sum([]byte("blob 4\x00dit\n")))
  • blob


  • tree


  • commit


Dit commands

Dit is a mini Git, the basical dit must support the below commands:

Command Description
dit init Create an empty Dit repository or reinitialize an existing one
dit add Add file contents to the index
dit commit Record changes to the repository
dit log Show commit logs
dit checkout Restore working tree files
dit diff Show changes between commits, commit and working tree, etc
dit status Show the working tree status

Dit only has master branch.



Everything in this repo is under MIT License unless otherwise specified.

MIT © zddhub