Skip to content

humanbeeng/tgit

Repository files navigation

tgit

Tiny Git - Lightweight Version Control System

Go build Code style: gofumpt

Installation

go install github.com/humanbeeng/tgit@latest

Commands

  • init: Initialises an empty tgit repository.
  • branch: Creates a new branch by having current branch as head.
  • add: Stage file(s)
  • commit: Commit staged files to branch.
  • checkout: DFS commit tree. Update file changes from all commits and checkouts to branch.
  • help: Displays a help message

Features

  • Commits are made against the checked out branch.
  • Uncreated branch cannot be checked out to.
  • Cannot reinit a tgit repository.
  • Cannot add duplicate files to staging if they are unmodified. Only those files that are either modified or haven't been staged before can be added and the old one will be overwritten in staged area.
  • Invalid command checks.
  • Checkout will yield all committed files that we made upto branch-name HEAD.
  • Cannot commit an empty staged area.

References

Git internals