| Crates.io | xit |
| lib.rs | xit |
| version | 0.4.0 |
| created_at | 2025-08-24 15:02:09.418661+00 |
| updated_at | 2025-08-26 09:35:43.899838+00 |
| description | A git-like command line tool written in Rust. |
| homepage | |
| repository | https://github.com/Shivrajsoni/xit |
| max_upload_size | |
| id | 1808467 |
| size | 64,484 |
Xit is a command-line tool that mimics some of the basic functionalities of Git. It is written in Rust and serves as a learning project to understand the inner workings of a version control system.
.xit-like repository structure..xitignore file to exclude files and directories from being tracked.Here are the commands currently supported by Xit:
xit init: Initializes a new repository in the current directory. It creates a .xit directory with the necessary subdirectories and files.
xit setup: Interactively prompts you to set up your global user name and email. This information is stored in ~/.xit/config and used for commits.
xit add <file>: Adds a file to the staging area (the index). The file's content is stored as a blob object.
xit commit -m "<message>": Creates a new commit with the staged files. It creates a commit object and a tree object to represent the state of the repository.
xit status: Shows the status of the working tree with color-coded output. It lists changes staged for commit (green), changes not staged for commit (red), and untracked files (red).
You can create a .xitignore file in the root of your repository to tell xit to ignore certain files and directories. This works similarly to Git's .gitignore.
Each line in the .xitignore file specifies a pattern. xit will not track any files or directories matching these patterns. The implementation currently ignores any path component that matches a line in the file (e.g., target will ignore any directory named target anywhere in the project).
By default, xit ignores .xit, .git, and target.
You can install xit from crates.io using cargo (once it's published):
cargo install xit
This will install the xit binary in your Cargo bin directory (e.g., ~/.cargo/bin), so you can run it from anywhere.
Alternatively, you can build it from source:
Clone the repository:
git clone https://github.com/Shivrajsoni/xit.git
cd xit
Build and run:
cargo run -- <command>
Once xit is installed, you can use it in any directory to manage your projects.
# 1. Create a new directory for your project
mkdir my-project
cd my-project
# 2. Initialize a new Xit repository
xit init
# 3. Set up your identity (only needs to be done once)
xit setup
# 4. Create a file and add it
echo "hello world" > hello.txt
xit add hello.txt
# 5. Create a file to ignore
mkdir logs
echo "dev.log" > logs/dev.log
# 6. Create a .xitignore file
echo "logs" > .xitignore
# 7. Check the status (logs/ will be ignored)
xit status
# 8. Commit the changes
xit commit -m "Initial commit"