x-git-update-to-latest-version
This morning in the git mailing list, I wrote a small shell recipe to update your git to the latest version but keeping the previous ones around, in case something goes wrong.
I noticed that what I wrote was a lot better than the hack-and-slash script I was using, so I promoted a cleaned up version of that to my scripts stash. Hence, you can now download x-git-update-to-latest-version
and enjoy painless git
updates.
You need to tweak two things at the top of the script:
- the location on your hard drive of the git.git clone (you need to create that with
git clone git://git.kernel.org/pub/scm/git/git.git
first); - the base directory where all the
git
versions will live.
You'll end up with something like this (I use /usr/local
as my base directory):
melo@MrTray:melo $ ls -dla /usr/local/git*
lrwxr-xr-x 1 root wheel 25 Jul 4 10:05 /usr/local/git -> git-v1.5.6.1-204-g6991357
drwxr-xr-x 7 root wheel 238 Jul 4 10:05 /usr/local/git-v1.5.6.1-204-g6991357
Each version will be named git-VERSION
where VERSION is the output of git-describe
. A symbolic link named git
points to the latest version.
Just add BASEDIR/git/bin
to your PATH
and your are done.