当前位置

网站首页> 程序设计 > 开源项目 > 编程语言 > 浏览文章

Git 的 JavaScript 实现 Gitlet

作者:小梦 来源: 网络 时间: 2024-06-11 阅读:

阿里百川梦想创业大赛,500万创投寻找最赞的APP

Gitlet 是 Git 的 JavaScript 实现。支持 init, add, rm, commit, branch, checkout, diff, remote, fetch, merge, push, pull, statusclone 操作。

下面命令解释了 Gitlet 的工作过程:

~   $ git clone git@github.com:maryrosecook/gitlet.git~   $ alias gitlet='node ~/gitlet/gitlet.js'~   $ mkdir a~   $ cd a~/a $ gitlet init~/a $ echo first > number.txt~/a $ gitlet add number.txt~/a $ gitlet commit -m "first"      [master 2912d7a2] first~/a $ cd ..~   $ gitlet clone a b~   $ cd b~/b $ echo second > number.txt~/b $ gitlet add number.txt~/b $ gitlet commit -m "second"      [master 484de172] second~   $ cd ../a~/a $ gitlet remote add b ../b~/a $ gitlet fetch b master      From ../b      Count 6      master -> b/master~/a $ gitlet merge FETCH_HEAD      Fast-forward~/a $ gitlet branch other~/a $ gitlet checkout other      Switched to branch other~/a $ echo third > number.txt~/a $ gitlet add number.txt~/a $ gitlet commit -m "third"      [other 656b332d] third~/a $ gitlet push b other      To ../b      Count 9      other -> other

使用 Gitlet 之前应该先安装 Node.js ,然后:

$ git clone git@github.com:maryrosecook/gitlet.git$ cd gitlet$ npm install$ npm test

相关阅读

热点阅读

网友最爱