thegit
v1.0.1
Published
Implementation of git in node.js.
Downloads
15
Readme
Introduction
Features
The followings are implemented in leGit and work similarly as in git, with the options supported in square brackets
- [x] legit init
- [x] legit add [-A, file list]
- [x] legit commit [-m, edit message using editor]
- [x] legit log
- [x] legit branch [branch name to create, no arguments to list branchces]
- [x] legit checkout [-b, commit hash, branch name]
- [x] legit reset [commit hash]
- [x] legit status
- [x] legit merge
Differences from git
While these commands work similarly there are a few differences to note:
- reset --mixed and --hard do not restore the index file to how it was during the target commit but clear them instead so there is a need to add again as required
- the implementation does not implement plumbing commands underneath
- force line endings, while reading a file, leGit autoconverts lineendings to \n. so while your working dir may contain CRLF, commits only contain LF and checking out any commit will replace line endings.
- in case of a merge conflict, we do not follow the same procedure as git, we use MERGE_HEAD alone to help identify incoming commit. during the commit, the index file does maintain 3 different versions of the files, the only thing that happens is conflict markers appearing in the conflicted files, need to make changes to show the conflicted files. The merge can be completed by merge --continue
Future plans
Installation (dev)
- Clone the repo and cd into it
git clone https://github.com/onedisha/leGit.git cd leGit
- Install dependencies
npm i npm i --global pkg
- Add current working directory to Path
pwd (get path and use that) // add that to the syste env path
- Change the path variable in src/index.js file to the path of src/legit.js
npm run bin
Now feel free to use this version of legit anywhere in your system, note that it takes the live version of all the contents of legit.js each time, hence your changes if any will affect the places where you use legit.
Installation (npm)
npm i -g thegit
Usage
If downloaded via npm you need to use thegit instead of legit (due to legit not being available) otherwise use legit.