5

In other words, is there a tool for managing versions of git, similar to what nvm and rvm do for node and ruby (respectively)?

EDIT:

I guess the title of my question is kind of misleading. I don't really want to work with multiple versions at the same time, per se. It's just annoying to download source tarballs and build/install manually. It would be wonderful to simplify the process. While there are general package management tools such as brew, yum, and apt, they can be slow to get updated and they differ between platforms. Having one simple interface to install/upgrade git would make me happy :)

Let's say I want to stay up-to-date with the latest git version, or even newly install in a fresh box/account, without having to do all the build steps manually. In my perfect world, it would be as easy as just doing something like this:

$ git --version
-bash: git: command not found
$ curl -sL https://SOMEURL | bash use latest
downloading v1.8.0...
building v1.8.0...
done!
using git v1.8.0
$ git --version
git version v1.8.0
$ gvm ls
  v1.8.0
* default -> 1.8 (v1.8.0)

Or, upgrading like follows:

$ git --version
git version 1.7.9.1
$ gvm ls
  v1.7.9.1
  v1.7.8
  v1.7.7.5
* default -> 1.7 (v1.7.9.1)
$ gvm install latest
downloading 1.8.0...
building 1.8.0...
done!
$ gvm alias default 1.8
$ gvm use default
now using git v1.8.0
$ git --version
git version 1.8.0
$ gvm ls
  v1.8.0
  v1.7.9.1
  v1.7.8
  v1.7.7.5
* default -> 1.8 (v1.8.0)
execjosh
  • 714
  • 7
  • 9

2 Answers2

4

Not that I have heard of. However, you can probably leverage your distribution's package manager to perform this task.

For example, Mac users who have Homebrew installed can use the brew switch command to change the currently active version of a particular package. The same trick can be used with many other package managers.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jordan Lewis
  • 16,900
  • 4
  • 29
  • 46
  • Thanks for your answer, Jordan. Your answer and VonC are very similar :) I guess the solution will have to be to just use each distro's package manager. – execjosh Oct 26 '12 at 07:19
3

Considering the "Git repository backwards compatibility" is very stable, the reason for working with multiple git version is low.
Most of the missing features would affect a client, not its ability to push to/pull from a remote repository (except for some transport mechanisms lacking for git prior to 1.6.4).

That is why there is no tool dedicated for that.
That being said:

  • nothing prevent you to compile as many git as you want locally, with different installation path.
  • you still can use the yum install git-core, or if you’re on a Debian-based distribution like Ubuntu, apt-get install git-core.
    However, that won't allows for a multiple installation of the same package.
    But you can still search and choose the one version you want at any given time: yum search git-core.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your answer, VonC. Your answer is very similar to Jordan's :) I guess the solution will have to be to just use each distro's package manager. – execjosh Oct 26 '12 at 07:18
  • 1
    On windows, there is one big reason I know of - the main git distribution, msysgit, does have big limitations with directory path length that cygwin version doesn't. But that's on Windows and thus not related to what OP is asking... just saying that the topic itself is relevant even there. – eis Oct 26 '12 at 07:20
  • @eis: good point. I see you commented on http://stackoverflow.com/questions/4992577/msys-git-and-long-paths – VonC Oct 26 '12 at 07:30