Welcome to the MY OWN GIT project! This project tries to mimic some of the features of Git. The primary goal is to appreciate the effort behind such a marvelous technology that we all use today and to understand how things work behind the scenes.
If you are intrigued by the workings of Git and want to learn about its internals, then this repo is for you. Hope you get to learn something new! ✨
The tool includes several commands such as init
, add
, commit
, and clone
.
Here is an in depth guide on the internals of the .git folder - What is in that .git directory? 🤯. It is recommended to go through the above blog to get a feel for the interal workings of the .git folder.
- System Requirements
- Installing Docker Desktop
- Building the Docker Image
- Running the Docker Container
- Using the Git Clone Tool
- File Structure
- Contributing
Ensure you have the following before starting:
- A machine with at least 2GB of RAM.
- Administrative access to install software.
- Download Docker Desktop for Windows from the official Docker website.
- Run the installer and follow the installation instructions.
- After installation, Docker Desktop will start automatically. If not, you can start it from the Start menu.
- Download Docker Desktop for Mac from the official Docker website.
- Open the
.dmg
file and drag Docker to the Applications folder. - Open Docker from the Applications folder.
- Docker Desktop is now available for Linux. Download Docker Desktop for Linux from the official Docker website.
- Follow the installation instructions provided on the website for your specific Linux distribution.
Here's how you can update the README for your "MY OWN GIT" project:
To get started with the git_2.0
tool, you can pull the Docker image directly from Docker Hub:
docker pull enamine/git_2.0
This command retrieves the latest version of the git_2.0
Docker image, ready to use.
- Run the Docker container.
docker run -it git_2.0:latest
This command will start a bash session inside the container, allowing you to interact with the git_2.0
tool.
Once inside the Docker container, you can use the git_2.0
tool with the following commands:
-
init: Initialize a new repository.
git_2.0 init
-
hash-object: Compute the object ID and optionally creates a blob from a file.
git_2.0 hash-object -w <file>
-
write-tree: Write the current index to the repository.
git_2.0 write-tree <filepath>
-
ls-tree: List the contents of a tree object.
git_2.0 ls-tree <tree_id>
-
cat-file: Provide content or type and size information for repository objects.
git_2.0 cat-file -p <object_id>
-
add: Add a file to the staging area.
git_2.0 add <file>
-
commit: Commit staged changes.
git_2.0 commit -m "Commit message"
-
clone: Clone an existing repository.
git_2.0 clone <repository_url>
.
├── CMakeCache.txt
├── cmake_install.cmake
├── CMakeLists.txt
├── Dockerfile
├── git_clone_completion.sh
├── LICENSE.md
├── Makefile
├── readme.md
├── src
│ ├── CPP
│ │ ├── cat_file.cpp
│ │ ├── commit_tree.cpp
│ │ ├── git_add.cpp
│ │ ├── git_init.cpp
│ │ ├── hash_object.cpp
│ │ ├── ls_tree.cpp
│ │ ├── main.cpp
│ │ ├── utils.cpp
│ │ └── write_tree.cpp
│ └── Headers
│ ├── cat_file.h
│ ├── commit_tree.h
│ ├── git_add.h
│ ├── git_init.h
│ ├── hash_object.h
│ ├── ls_tree.h
│ └── write_tree.h
│ ├── utils.h
│
└── Welcome.txt
To contribute to this project and set up the development environment, follow these steps:
-
Clone the repository:
git clone https://github.com/ENAMINE1/MY-OWN-GIT.git cd MY-OWN-GIT
-
Build the Docker image:
docker build -t git_2.0:latest .
Building the Docker image locally allows you to make changes and test them before committing.
-
Run the Docker container:
docker run -it -v "$(pwd):/home/user/" git_2.0:latest
This command starts a bash session inside the container, enabling you to interact with the
git_2.0
tool and test your changes. -
Make your changes:
- Modify the code or add new features as needed.
-
Commit your changes:
git commit -am 'Add new feature'
-
Push your changes:
git push origin feature-branch
-
Create a Pull Request:
- Submit a Pull Request to merge your changes into the main branch of the repository.
Thank you for contributing to "MY OWN GIT"! 🌟