我可以不安装使用git吗?

时间:2011-05-05 04:32:08

标签: git portable-applications

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

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

编辑:

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

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

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

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

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

2 个答案:

答案 0 :(得分:9)

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

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

答案 1 :(得分:3)

难道你不能只使用--prefix=/path/to/install/folder/从源代码编译它而只是将make install编译到该文件夹​​中吗?

相关问题