Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using git to update itself

I see on the git download page http://git-scm.com/downloads [among many other tutorial pages] that you can update git via itself. currently my desktop has git 1.7.9.5 and the newest is 1.8.1.3

I am running Ubuntu 12.04 LTS and running these commands in the home dir [~/]

I ran the following commands and had the following output:

~$ git version
git version 1.7.9.5
~$ git clone https://github.com/git/git.git
Cloning into 'git'...
remote: Counting objects: 149633, done.
remote: Compressing objects: 100% (49646/49646), done.
remote: Total 149633 (delta 109386), reused 136311 (delta 98050)
Receiving objects: 100% (149633/149633), 34.92 MiB | 864 KiB/s, done.
Resolving deltas: 100% (109386/109386), done.
~$ git version
git version 1.7.9.5

the end result is that the git version is the same. the only difference is that there is now a folder named git in my home directory with what I can only assume are the files that make up the software. I am clearly missing a few steps, I have searched all over Google and YouTube to find walk-throughs or some sort of a further explanation other than 'you can get git via git, just type this command'.

I apologize if this question has been answered before. If anybody knows where I can find the missing steps, I would very much appreciate a link/explanation.

I also apologize that this seems like an agonizingly simple thing that I could not figure out on my own.

And lastly, I am immensely grateful to any and all who will help me find an answer!

EDIT 3.18.13: So I ended up having to do this again when I got a new laptop this week; thanks to you guys, I was able to run git --version and get back git version 1.8.2

I followed the directions from the git book, thanks iltempo:

Then, compile and install:

$ tar -zxf git-1.7.2.2.tar.gz
$ cd git-1.7.2.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install

except that I got a zip file from github, so I unzipped it instead. I didn't do any other steps...

This is/was my first time building something from source so I am not really sure what some of the terms mentioned below mean:

'ensure /usr/local/bin is prepended to your path' -iltempo

I see how to add a directory to my path, but I do not understand the meaning of this or what is happening when I do this.

like image 423
jguerra Avatar asked Feb 18 '23 09:02

jguerra


2 Answers

"Updating git with git" means updating the git repo sources with a git pull, once you have cloned https://github.com/git/git.

You would still need to build git from said sources, and install it before seeing a difference in the git --version command.

See the "INSTALL" file:

$ make prefix=/usr/local all doc info ;# as yourself
# make prefix=/usr/local install install-doc install-html install-info ;# as root

Since you are installing that updated git in /usr/local/bin, make sure that path comes first in your own $PATH environment variable (that you can set in your .profile)


The other way would be to use apt-install (see "How to upgrade Git on Ubuntu Hardy?"), but when I look for the package git-core, the Precise package only goes up to git_1.7.9.5.
That is why building from sources can be an alternative to waiting for git-core to be updated.

like image 138
VonC Avatar answered Feb 20 '23 00:02

VonC


git uses the standard GNU autotools setup, see the INSTALL file in the sources. Then you can do the standard ./configure; make; make install dance.

For my personal use I set it up with prefix=$HOME, and have an alias git=~/bin/git in my .bashrc, so PATH is not a issue.

like image 25
vonbrand Avatar answered Feb 19 '23 23:02

vonbrand