CodeKeeper is a lightweight version control application tailored for small teams of developers. It provides an easy-to-use command-line interface for managing file versions, resolving conflicts, and tracking changes. CodeKeeper is designed to operate with a central repository for streamlined collaboration and efficiency.
-
Initialize Repository
- Set up a new central repository.
- Automatically creates essential directories (
.keep
,.versions
, etc.). - Checks if the repository is already initialized to prevent duplication.
-
File Versioning
- Commit files or entire directories using wildcards (
*.*
,.
). - Maintain a history of commits with GUIDs, timestamps, and file paths.
- Commit files or entire directories using wildcards (
-
Conflict Detection and Resolution
- Check for conflicts in files against the latest committed version.
- Resolve conflicts by providing a resolution file.
-
Branching and Merging
- Create branches for isolated development.
- Merge changes from two branches with automatic conflict detection.
-
History and Rollback
- View the history of commits, including GUIDs, timestamps, and file details.
- Rollback a file or repository to a specific version or commit.
-
Archiving
- Archive the
.versions
directory for backup or storage.
- Archive the
-
Authentication
- Ensure that only authorized users can perform certain actions (e.g., commit, resolve conflicts).
- SHA-256 Commit IDs: Every commit is uniquely identified and tamper-evident.
- Branching: Create and switch between branches for parallel development.
- Staging Area: Add/reset files before committing, similar to
git add
/git reset
. - Status Command: View staged, modified, and untracked files.
- Authentication: User registration, login, logout, and enforcement for protected actions.
- Remote Support: Set a remote repository, push and pull commits and versions.
- Hooks: Pre-commit and post-commit hooks for automation.
- Merge & Conflict Resolution: Merge files/branches, interactive/manual conflict resolution, and conflict listing.
- User Management: List users, show current user (
whoami
). - Robust Initialization: Secure repo setup, including user file permissions.
- Operating System: Linux (requires
sudo
for certain operations). - Dependencies: C++ Standard Library and
filesystem
support. - Optional Tools:
zip
(for archiving).
-
Clone the repository:
git clone <repository-url> cd CodeKeeper
-
Compile the application:
g++ -std=c++17 -o ./build/codekeeper codekeeper.cpp -lssl -lcrypto
-
Run install.sh file for installation, the shell script will create the necessary folders and move the application to the required folder:
sudo chmod +x install.sh ./install.sh
codekeeper --help
-
Initialize Repository
sudo codekeeper init <project_name>
-
Commit Files
codekeeper commit "<commit_message>" <file1> <file2> ...
Use
.
or*.*
to commit all files in the current directory. -
View History
codekeeper history
-
Rollback
codekeeper rollback <file|commit_guid>
-
Check for Conflicts
codekeeper conflicts <file>
-
Resolve Conflict
codekeeper resolve <file> <resolution_file>
-
Create a Branch
codekeeper branch <branch_name>
-
Merge Branches
codekeeper merge <branch1> <branch2>
-
Archive Versions
codekeeper archive
Requires C++17, OpenSSL, and Linux (tested on Ubuntu):
sudo apt-get install libssl-dev
# Compile
g++ -std=c++17 -o codekeeper codekeeper.cpp -lssl -lcrypto
sudo bash codekeeper-postinstall.sh
This creates /var/lib/CodeKeeper
and a skeleton repo structure.
./codekeeper init <projectName>
cd /var/lib/CodeKeeper/<projectName>
./codekeeper auth register <username> <password>
./codekeeper auth login <username> <password>
# Add files to staging
./codekeeper add file1.cpp file2.cpp
# Check status
./codekeeper status
# Commit staged files
./codekeeper commit "Initial commit" file1.cpp file2.cpp
# View history
./codekeeper history
Command | Description |
---|---|
init <projectName> |
Initialize a new repository |
add <files> |
Add files to staging area |
reset <files> |
Remove files from staging area |
status |
Show status of working directory and staging area |
commit <message> <files> |
Commit specified files (if staging is empty) |
rollback <target> [commitGUID] |
Revert a file or repo to a specific version |
history |
View commit history |
conflicts <file> |
Check for conflicts in a file |
resolve <file> <resolutionFile> |
Resolve a conflict |
archive |
Archive the .versions folder |
auth register <user> <pass> |
Register a new user |
auth login <user> <pass> |
Login as a user |
auth logout |
Logout current user |
merge <branch1> <branch2> |
Merge two branches |
switch <branch> |
Switch to a branch |
set-remote <path> |
Set remote repository path |
push |
Push commits/versions to remote |
pull |
Pull commits/versions from remote |
list-conflicts |
List all files with conflicts |
whoami |
Show current authenticated user |
list-users |
List all registered users |
merge-files <f1> <f2> <out> [--interactive] |
Merge two files (optionally interactively) |
- Place executable
.pre-commit
and.post-commit
scripts in the repo root to run before/after each commit.
- The
.users
file is created with mode 600 (owner read/write only). - Only authenticated users can commit, rollback, or resolve conflicts.
- Session state is stored in
.session
in the repo root.
- Use
set-remote <path>
to configure a remote CodeKeeper repo. push
andpull
sync commits and versioned files.
- If you see
Error: You must authenticate first
, runauth login
. - If registration fails, ensure the
.users
file exists and is writable. - For OpenSSL errors, ensure
libssl-dev
is installed and linked.
- This project is for educational and internal use. Not a drop-in replacement for Git.
- For advanced usage, see comments in
codekeeper.cpp
and the help command (./codekeeper
).
- The central repository path is configured in
/usr/bin/codekeeper/codekeeper_config
. - Ensure the
.keep
directory and other project files are correctly created within the central origin path.
Contributions to CodeKeeper are welcome! If you'd like to improve the application or report issues, please create a pull request or open an issue on GitHub.