Skip to content

Instantly share code, notes, and snippets.

@christianromney
Created August 21, 2008 19:24
Show Gist options
  • Save christianromney/6614 to your computer and use it in GitHub Desktop.
Save christianromney/6614 to your computer and use it in GitHub Desktop.
My script to upgrade Git
#!/usr/bin/env ruby -w
require 'fileutils'
include FileUtils
Version = ARGV.first
Downloads = File.join(ENV['HOME'], "Downloads")
BashCompletion = File.join(ENV['HOME'], ".bash_completion", "git_bash_completion")
# Create src download directory, if needed
mkdir_p(Downloads) unless File.exists?(Downloads)
# Download and extract the Git source tarball and documentation
cd(Downloads) do
`wget http://kernel.org/pub/software/scm/git/git-#{Version}.tar.gz`
`tar xvzf git-#{Version}.tar.gz`
end
# Build and install Git
cd(File.join(Downloads, "git-#{Version}")) do
`./configure --prefix=/usr/local && make && sudo make install`
end
# Install the man pages
cd(Downloads) do
`wget http://www.kernel.org/pub/software/scm/git/git-manpages-#{Version}.tar.bz2`
`sudo tar xjv -C /usr/share/man -f git-manpages-#{Version}.tar.bz2`
`sudo periodic weekly`
end
# Update bash completion
cd(Downloads) do
`cp contrib/completion/git-completion.bash #{BashCompletion}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment