/rgit

Git implementation in Rust from scratch.

Primary LanguageRustMIT LicenseMIT

Rgit

Rgit is a simplified Git implementation written in Rust. It replicates key features of Git, such as creating repositories, adding files, committing changes, and working with branches, tags, and remotes.

Features

  • Initialize a new Git repository or reinitialize an existing one (init)
  • Add files to the staging area (add)
  • Commit changes to the repository (commit)
  • Check the status of your working directory (status)
  • Show commit history (log)
  • Create, list, or delete branches (branch)
  • Checkout to different branches or commits (checkout)
  • Create, list, or delete tags (tag)
  • Compare changes between commits or working tree (diff)
  • Manage repository configuration (config)
  • Manage remote repositories (remote)

Installation

  1. Clone the repository:
git clone https://github.com/Kei-K23/rgit.git
  1. Navigate to the project directory:
cd rgit
  1. Build the project:
cargo build --release
  1. Run the rgit binary:
./target/release/rgit

Usage

You can interact with rgit through various subcommands. Here are some examples:

Initialize a Repository

./target/release/rgit init

This will create an empty Git repository or reinitialize an existing one.

Add Files

./target/release/rgit add <file>

Stage file contents to the index.

Commit Changes

./target/release/rgit commit -m "Your commit message"

Record changes to the repository with a message.

Check Repository Status

./target/release/rgit status

Display the current state of the working directory and staging area.

View Commit Log

./target/release/rgit log

Show the commit history of the repository.

Create a New Branch

./target/release/rgit branch <branch_name>

Create a new branch.

Checkout a Branch or Commit

./target/release/rgit checkout <branch_name|commit_hash>

Switch to another branch or checkout a specific commit.

Tag Management

Create a new tag:

./target/release/rgit tag <tag_name>

List all tags:

./target/release/rgit tag

Delete a tag:

./target/release/rgit tag -d <tag_name>

Compare Changes

./target/release/rgit diff

Show changes between the working directory, staged changes, and commit history.

Configure Repository

Set a configuration value:

rgit config set <key> <value>

Get a configuration value:

rgit config get <key>

Manage Remotes

Add a new remote:

rgit remote add <name> <url>

Remove a remote:

rgit remote remove <name>

License

This project is licensed under the MIT License. See the LICENSE file for details.