Skip to content

96jhasuraj/mygit

Repository files navigation

Custom Git Implementation

A WIP implementation of a simplified Git client in C++.

directory looks like this before executing any commands

before git init

Implemented Features

  1. git init
    Git init output

  2. git hash-object file Hash-object output

  3. git find-object hash

    Find-object output

  4. git cat-object hash
    Displays the contents of a Git object (currently supports blobs only).
    Cat-object output

  5. git add
    Git add output
    Git add output
    Git add output
    Git add output

  6. git ls-files
    Ls-files output

  7. git status
    Shows the status of the working directory and staging area.
    Before changes:
    Status before changes
    After changes (removed features.txt, added f3.txt, modified f1.txt):
    Status after changes

  8. git diff changes (edited f1.txt):
    alt text

  9. git write-tree Writes tree alt text

  10. git commit alt text

Planned in Future

  1. refactor code
  2. add error handling - ignored all / any edge cases for now
  3. singleton class
    • learn other design patterns & refactor accordingly

learnings

  1. Would have been better to add test / edge cases handling from the start , now I have forgotten what assumptions i took . Never doing this again
  2. Learnt c++ while implementing this , fun :) , now i think i will pick up a book
  3. Deeper understanding of how GIT works under the hood. I simplified some optimisations for storing index . Did not add multi branch feature for now.

Prerequisites

  • C++17
  • zlib for compression
  • openssl for sha1

About

a mini git implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages