我可以在不安装的情况下使用git吗?
我听说过关于git的好东西,我想在安装之前尝试一下。如果我想在学校使用git,将它放在闪存驱动器上也是非常棒的。是否有可能使用像/path/to/git init
这样的完整路径?我可以在不安装的情况下使用git吗?
我主要使用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/
或者你可以试试JGit,它是一个单一的bash文件,你可以运行基本的Git命令。 Git自包含在该bash脚本中。
下载JGit,选择第二个链接(自给命令行可执行文件)位于此处下载一次http://www.eclipse.org/jgit/download/,重命名为jgit.sh和公正的运行它:jgit.sh
(记得chmod +x jgit.sh
)
你就不能编译从源代码,使用--prefix=/path/to/install/folder/
,只是它make install
到该文件夹?
我成功地使用下列命令构建的代码安装' – styfle 2011-05-05 05:49:13
安装git的心不是那么多的承诺。即使你不卸载它,我确定你不会注意到它占用的几个megs。 – 2011-05-05 04:39:02
@Matt我甚至不确定你是否可以完全卸载它。希望卸载将改变之前的路线。我不喜欢只安装在同一天卸载。总有一些东西会被抛在后面:/ – styfle 2011-05-05 04:47:04
你可以举一个卸载后留下的文件的例子吗? – Blender 2011-05-05 04:48:49