• Blogs (9)
    • 📱 236 - 992 - 3846

      đź“§ jxjwilliam@gmail.com

    • Version: ‍🚀 1.1.0
  • MacBook Air: adding `git branch` in PS1

    Blogs20152015-01-04


    add `git branch` in mac command line

    Reference: Creating a Happy Git Environment on OS X

    touch ~/.bash_profile
    # Git branch in prompt.
    parse_git_branch() {
        git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/ (1)/'
    }
    export PS1="u@h W[33[32m]$(parse_git_branch)[33[00m] $ "
    Pre-installed:
    • XCode
    • brew: use brew install node, java, mysql, jdk-8u25-macosx-x64.dmg, apache-maven-3.2.3-bin.tar.gz etc.

    By the way, ~/.bash_profile and ~/.bashrc are all needed; `Advanced REST Client` and `postman` are good Chrome plugins, as well as Batarang.