15

我听说过关于 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/

4

2 回答 2

10

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

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

于 2011-05-05T05:13:35.960 回答
3

你不能只从源代码编译它,使用它--prefix=/path/to/install/folder/并将make install其放入该文件夹吗?

于 2011-05-05T04:43:08.157 回答