开发者

Can I use git without installing?

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/开发者_StackOverflow社区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)


Can't you just compile it from source, using --prefix=/path/to/install/folder/ and just make install it to that folder?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜