我可以使用git而不安装吗? [英] Can I use git without installing?

查看:176
本文介绍了我可以使用git而不安装吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过关于git的好东西,我想在安装之前尝试一下。如果我想在学校使用git,将其放在闪存驱动器上也是非常棒的。是否可以使用完整路径,如 / path / to / git init



我主要使用Mac OS X所以这个问题主要针对Mac,但我也想知道在其他操作系统上是否可能。



编辑:



从源代码编译。我使用了下面的命令:

  cd git-1.7.5.1 #this是包含src的解压缩目录
make configure
./configure --prefix = / path / to / install / git
make all
sudo make install

这个方法的缺点是一旦编译完成,目录就是200MB。
这就是为什么我选择jgit作为答案。 jgit.sh 小于2MB,并支持以下命令:

 添加文件内容到索引
分支列出,创建或删除分支
checkout签出到工作树的分支
克隆将存储库克隆到新目录
提交记录更改到存储库
守护进程通过git导出存储库://
diff显示差异
fetch从另一个存储库更新远程引用
init创建一个空的git存储库
日志查看提交历史
合并合并两个开发历史
push从本地引用更新远程资源库
rm停止跟踪文件
标记创建标记
version显示jgit $ b的版本$ b

您可以在此下载 jgit.sh http://www.eclipse.org/jgit/download/

解决方案

或者你可以试试JGit,它是一个单独的bash文件,你可以运行基本的Git命令。 Git自包含在该bash脚本中。



要下载JGit,请选择位于此处的第二个链接(自包含的命令行可执行文件)http://www.eclipse.org/jgit/download/ 下载后,将其重命名为jgit.sh并运行它: jgit.sh (请记住 chmod + x jgit.sh


I have heard good things about git and I would like to try it out before installing it. This would also be great to put it on a flash drive if I wanted to use git at school. Is it possible to use the full path like /path/to/git init?

I primarily use Mac OS X so the question is mostly directed for Mac, but I would also like to know if it is possible on other OS's as well.

EDIT:

Compiling from source works. I used the following commands:

cd git-1.7.5.1 #this is the decompressed dir containing src
make configure
./configure --prefix=/path/to/install/git
make all
sudo make install

The downside to this method is that once compiled, the directory is a hefty 200MB. That is why I chose jgit as the answer. jgit.sh is less than 2MB and supports the following commands:

add       Add file contents to the index
branch    List, create, or delete branches
checkout  Checkout a branch to the working tree
clone     Clone a repository into a new directory
commit    Record changes to the repository
daemon    Export repositories over git://
diff      Show diffs
fetch     Update remote refs from another repository
init      Create an empty git repository
log       View commit history
merge     Merges two development histories
push      Update remote repository from local refs
rm        Stop tracking a file
tag       Create a tag
version   Display the version of jgit

You can download jgit.sh here http://www.eclipse.org/jgit/download/

解决方案

Or you can try out JGit, it is a single bash file that you can run basic Git commands. Git is self contained in that bash script.

To download JGit, choose the second link (Self contained command line executable) located here http://www.eclipse.org/jgit/download/ once downloaded, rename it to jgit.sh and just run it: jgit.sh (remember to chmod +x jgit.sh)

这篇关于我可以使用git而不安装吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆