Thursday, April 9, 2015

Uninstall's Git and Use Homebrew's Instead

It looks like git_osx_installer provided by is no longer being maintained and the Homebrew version is. Here's how to fix that:

  1. Uninstall the git installed by this installer (command from here):

    sudo rm -rf /usr/local/git/ /usr/bin/git /etc/paths.d/git /etc/manpaths.d/git

  2. Install homebrew, if you haven't, and:

    brew update
    brew install git
  3. Fix any paths/etc. that you might have that dependent on the other git, if any.
  4. Restart

When you want to upgrade, whenever homebrew updates git (and it seems to stay up-to-date recently), you can do:

brew upgrade git

To update the Git and Git Flow completion and your Git prompt as I described previously to work with Homebrew Git, assuming you have installed git flow and git flow completion, you can put this in your ~/.bashrc or ~/.bash_profile:

# git provided by homebrew
source /usr/local/etc/bash_completion.d/git-completion.bash
# if fails, do find /usr/local/Cellar -name git-flow-completion.bash to find path and set it here
source /usr/local/Cellar/git-flow-avh/1.8.0/etc/bash_completion.d/git-flow-completion.bash
source /usr/local/etc/bash_completion.d/
PS1='\h:\W$(__git_ps1 " (%s)") \u\$ ';

No comments: