Skip to content

MwauratheAlex/jit_vcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JIT Version Control System

JIT is a simple version control system implemented in Go. It allows you to track changes to your files and collaborate with others.

Features

  • Track changes to files
  • Commit changes with messages
  • View commit history
  • Revert to previous versions

Installation

  1. Clone the repository
git clone https://github.com/MwauratheAlex/jit_vcs.git
cd jit_vcs
  1. Resolve dependancies
go mod tidy
  1. a. Install jit globally(requires go installed)
go install 
  • ensure your $PATH includes go binaries directory (default is $HOME/go/bin or $GOBIN) You can verify this with:
echo $PATH
  • if the directory is not in your $PATH, add it. Example in bash
export PATH=$PATH:$(go env GOPATH)/bin
  1. b. Alternatively, build the JIT binary
go build -o jit main.go
  • this will create an executable jit binary in the current directory
  • Copy it to a directory in your $PATH to use globally
cp jit /usr/local/bin/

or Run it directly from any directory.

./jit

Testing

go test ./command

Usage

Initialize a new JIT repository:

mkdir new_repo # create new_repo directory
cd new_repo # change into the new_repo directory

jit init # Initialize Repository

Add files to the repository:

jit add file1 file2 README.md

Ignore files

  • add the files to .jitignore
echo file2 .jitignore

Commit changes:

jit commit -m "Your commit message"

View commit history:

jit log

View commit diffs

jit diff <old-commit-hash> <new-commit-hash>

Create new branch

jit branch <branch-name>

View Branches

jit branch

Switch branch:

jit checkout <branch-name>

Merge Branch

jit merge <branch-name>

Clone Repo

jit clone <repo-to-clone> <destination-folder>

Handling Merge Conflicts

  • incase of merge conflicts, conflict markers are added to the file
  • Conflict resolution is not implemented yet
  • Example file with conflicts after merge
# jit testing

Here I'm just testing JIT.
Two lines added in readme

one more commit

one last commit
<<<<<<< HEAD
One more thing
add in master now
=======
One more thing
>>>>>>> target_branch

Ignoring files

Create a .jitignore file and list the full paths of the files you want to ignore

Example .jitignore

git.c
secret.txt
  • This files will be automatically ignored during jit operations.
  • jit also ingores .jit folder and .jitignore itself.
  • this means that the .jitignore folder will not be copied during cloning. and in other relevant operations like jit add <file> ...

Issues

  • Needs more comprehensive testing

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

Contact

For any questions or feedback, please contact [email protected].

About

A version control system implemented in go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages