A version control system implemented in Java.
This software requires a command-line interface such as Git or Windows CMD to run. To set up:
- Navigate to the project directory
- Compile the Java files:
javac versio/*.java
The software uses a .versio
directory for persistent storage, allowing it to maintain state across computer reboots.
java Versio.Main init
Creates a .versio
directory to store commits, blobs, and other files for persistence.
java Versio.Main add [fileName]
# Example: java Versio.Main add CS.txt
Adds a file to the staging area. When committed, creates a snapshot of the file and stores the relationship between the filename and blob (file content) in a HashMap of strings.
java Versio.Main commit [commitMessage]
Creates a commit with a unique SHA-1 ID and stores it in the commit directory within .versio
. The commit contains snapshots of all staged files (filename -> blob mappings) and is serialized on the computer.
java Versio.Main branch [branchName]
Creates a new branch pointer that points to the current commit. Note: This does not change the head pointer to the new branch.
java Versio.Main status
Shows:
- Existing branches
- Files in staging area (both additions and removals)
- Modified but unstaged files
- Untracked files in the working directory
java Versio.Main log
Displays all commits in the current commit chain.
Three checkout options are available:
-
Switch to a branch:
java Versio.Main checkout [branchName]
Moves the Head pointer to the specified branch and restores files to that branch's version.
-
Restore a file in current commit:
java Versio.Main checkout -- [fileName]
-
Restore a file from specific commit:
java Versio.Main checkout [commitID] -- [fileName]
- All version control objects are stored in the
.versio
directory - Uses a HashMap to store filename to blob mappings
- Commits are stored with SHA-1 IDs
- Maintains persistence across system reboots
- Java Development Kit (JDK)
- Command-line interface (Git or CMD)