How do I install the latest version of Git with apt?

Use the PPA from the maintainers of git on Ubuntu:

sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

If you don't know what PPAs are, first read What are PPAs and how do I use them?

If you receive an error about add-apt-repository command not found you need to install software-properties-common, and then redo the above steps.

sudo apt-get install software-properties-common

This what i did to upgrade git 1.7.9.5 to 2.xxx on Ubuntu 12.04:

sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version