How can i make ZSH use the latest git version?

I am using ZSH with oh-my-zsh on OS X.

Today I used hombrew to update to the latest version of git (1.8.something).

  • Alter message in Gerrit code review
  • Git how to save a preset git log --format
  • Undo “git checkout HEAD foo.c” in git scm
  • how to use git to make commits from two different machines
  • What does git mean by, “unable to migrate objects to permanent storage”?
  • Is there a Far File Manager plugin for GIT?
  • However, if I run

    ➜  ~  git --version
    git version 1.7.10.2 (Apple Git-33)
    

    I see that still an older version is used. On bash everything works fine and the latest version of git is called.

    Since I am new to ZSH, any advice on how to set up ZSH to use the “new” git is appreciated!

    Best,

    Tobi

  • Fabric error: Fatal error: local() encountered an error (return code 2) while executing 'git commit -m 'message'
  • Let git / go get use proxy domains
  • Git hook to prevent hard resets on the live server?
  • Cloning private repo at gitlab works without password?
  • Git branches with completely different content
  • Use Git branches for book chapters
  • 3 Solutions collect form web for “How can i make ZSH use the latest git version?”

    If the PATH modification didn’t instantly work, you need to realize that with zsh you need to type “rehash” for zsh to recognize there are new executables in the path. Or just log out and back in.

    This means that your $PATH variable isn’t set up to include the right git (and everything else homebrew installs).

    Try doing echo $PATH from both bash and zsh. You should see at least one difference: the directory where you installed homebrew, probably /usr/local/bin. (It’ll either not be in there, or be after /usr/bin, where the Apple-supplied binary lives.)

    To fix it, add a line like

    export PATH=/usr/local/bin:$PATH
    

    to your ~/.zshenv.

    Compare the outputs of which git (and the outputs of echo "$PATH") in bash and zsh.

    The directory containing an up-to-date git is probably not present in $PATH variable for zsh, but it is in bash. It’s likely caused by $PATH items being added in your ~/.bashrc and/or ~/.bash_profile file, which zsh doesn’t source on startup. If it’s so, add the same assignment to PATH to your ~/.zshrc

    Git Baby is a git and github fan, let's start git clone.