MyGit is a Git-like command-line tool written in C.
To build the Docker image:
make docker-buildAlternatively, running make all or simply make will also build the image.
To run mygit commands inside a Docker container:
make run ARGS="<command> [<args>]"For example, to initialize a new repository:
make run ARGS="init"To hash a file named example.txt and write it to the object store:
touch example.txt
echo "hello world" > example.txt
make run ARGS="hash-object -w example.txt"To view the content of an object (replace <object_hash> with the actual hash):
make run ARGS="cat-file -p <object_hash>"The .git directory used by the application inside the Docker container is mapped to .git_docker_data on your host machine. This allows you to inspect the Git data created by mygit.
all(default): Builds the Docker image. Equivalent tomake docker-build.docker-build: Builds the Docker image for the application.run: Runs themygitapplication inside a Docker container.- Use
ARGSto pass commands and arguments tomygit. Example:make run ARGS="init"
- Use
docker-run: Alias forrun, also builds the image if it doesn't exist.clean: Removes the compiled binary (mygit), the local.gitand.git_docker_datadirectories, and the Docker image and container.
To remove build artifacts, Docker images, and containers:
make clean.
├── Dockerfile # Defines the Docker build process
├── Makefile # Defines build, run, and clean tasks
├── README.md # This file
└── src/
└── main.c # Main C source code for mygit