A basic version control system implemented in Go. This system allows users to manage and track changes to files, commit changes, and switch between different versions of the files.
- Configuration: Set and get a username for commits.
- Add: Add files to the index to track changes.
- Commit: Save changes with a commit message.
- Log: View commit history.
- Checkout: Restore files to a specific commit state.
- Go installed on your machine.
- An IDE installed. (GoLand prefered).
-
Clone the repository
-
CD into the project directory (or open the directory from you IDE)
-
Build the project using:
go build -o svcs
Set or get your username:
./svcs config [username]
To set a username:
./svcs config JohnDoe
To get the current username:
./svcs config
Add a file to the index:
./svcs add [filename]
Example:
./svcs add file1.txt
Commit the changes with a message:
./svcs commit [commit-message]
Example:
./svcs commit "Initial commit"
Show the commit history:
./svcs log
Restore files to a specific commit:
./svcs checkout [commit-id]
Example:
./svcs checkout 0b4f05fcd3e1dcc47f58fed4bb189196f99da89a
. ├── vcs │ ├── commits │ │ ├── [commit-id] │ │ │ ├── [file1.txt] │ │ │ └── [file2.txt] │ │ └── ... │ ├── config.txt │ ├── index.txt │ └── log.txt ├── file1.txt ├── file2.txt └── untracked_file.txt
- commits/ directory contains commit snapshots.
- config.txt stores the username.
- index.txt lists tracked files.
- log.txt records commit messages and history.
- Ensure you add files to the index before committing.
- The checkout command only restores files that are tracked in the index.
Feel free to open issues or submit pull requests. Contributions are welcome!
For more information or if you encounter any issues, please contact ali.b.naqvi@berkley.edu or open an issue on GitHub.