2011-05-05 150 views
13

我聽說過關於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/

+0

安裝git的心不是那麼多的承諾。即使你不卸載它,我確定你不會注意到它佔用的幾個megs。 – 2011-05-05 04:39:02

+1

@Matt我甚至不確定你是否可以完全卸載它。希望卸載將改變之前的路線。我不喜歡只安裝在同一天卸載。總有一些東西會被拋在後面:/ – styfle 2011-05-05 04:47:04

+0

你可以舉一個卸載後留下的文件的例子嗎? – Blender 2011-05-05 04:48:49

回答

9

或者你可以試試JGit,它是一個單一的bash文件,你可以運行基本的Git命令。 Git自包含在該bash腳本中。

下載JGit,選擇第二個鏈接(自給命令行可執行文件)位於此處下載一次http://www.eclipse.org/jgit/download/,重命名爲jgit.sh和公正的運行它:jgit.sh(記得chmod +x jgit.sh

+0

有趣。這僅僅是一個Git的Java實現?它看起來有點慢,但它非常小(小於2MB)。我怎樣才能找出哪些命令被支持? – styfle 2011-05-05 05:43:22

+1

你試試看:) – Blender 2011-05-05 05:52:24

+0

@Blender我很慢。您在運行腳本時列出了這些命令。 – styfle 2011-05-05 06:12:29

3

你就不能編譯從源代碼,使用--prefix=/path/to/install/folder/,只是它make install到該文件夾​​?

+0

我成功地使用下列命令構建的代碼安裝' – styfle 2011-05-05 05:49:13

相關問題