This is a distribted version control system similar to git.
My motivation behind it to learn more about internals of Git, and also advance my knowledge and practice writing code in C/C++ language.
The architecture i followed to bild this version control system is very much simailar to git. In this architecture every file is treated as BLOB
and every directory is treated as a TREE
a tree may conatin either one or more blobs and it may also contain another tree.
First when the command <executable> init
is being run it will create a folder named .jh
this folder contains
different information about the repository. When the programmer runs <executable> commit "<commit-message>"
it first compresses the blob data and creates a unique
hash id after which the compressed data is stored in .jh/objects
folder, similarly tree is also compreesed conationg information
like blob name, blob hash is stored in .jh/objects
.
For further inqiry please visit git internals
.
In Debian/Linux bash
sudo apt-get update
sudo apt-get install libssl-dev zlib1g-dev
-
First create the exectable by rnning the command
make
-
After running
make
command rn commandmake clean
to delete*.o(object files)
files -
After exectable has been created, run command
<executable> init
this command Initializes the repository -
After Initializing the repository run command
<executable> commit "<commit-message>"
to commit changes to the repository. -
Run command
<executable> log
to see all the commits with its hashes -
To restore your working directory to different commit run command
<executable> restore <hash>
.
-
<executable> hash-object <filename>
this command compresses the files using zlib compression and then createshash
of that compressed data -
<executable> cat-file <hash>
to see contains of file which is stored in.jh/objects
-
<executable> ls-tree <folderpath> -w
to create a tree object
This program is written in C/C++ and tested in Debian/Linux before running it in windows or any other operating you may have to change some code 🔧. Even though i tried my best to write croos-platform code Thanks