Skip to content

Instantly share code, notes, and snippets.

@zaps166
Last active May 27, 2020 11:38
Show Gist options
  • Select an option

  • Save zaps166/099af67a6f0047e557c4ca431f55cd22 to your computer and use it in GitHub Desktop.

Select an option

Save zaps166/099af67a6f0047e557c4ca431f55cd22 to your computer and use it in GitHub Desktop.

Revisions

  1. zaps166 revised this gist Feb 18, 2018. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    getGitInfo()
    {
    checksum=$(git rev-parse --short HEAD 2> /dev/null)
    if [ ! -z $checksum ]; then
    branch=$(git symbolic-ref --short HEAD 2> /dev/null)
    if [ ! -z $branch ]; then
    echo -e " ($branch $checksum)"
    else
    echo -e " ($checksum)"
    fi
    branch=$(git symbolic-ref --short HEAD 2> /dev/null)
    if [ ! -z $branch ] && [ ! -z $checksum ]; then
    echo -e " ($branch $checksum)"
    elif [ ! -z $checksum ]; then
    echo -e " ($checksum)"
    elif [ ! -z $branch ]; then
    echo -e " ($branch)"
    fi
    }

  2. zaps166 revised this gist May 24, 2017. No changes.
  3. zaps166 revised this gist May 24, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,9 @@ fi
    OS=$(uname)
    if [ $OS == "Darwin" ]; then
    GIT_COMPLETION_PATH="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash"
    if [[ ! -e $GIT_COMPLETION_PATH ]]; then
    GIT_COMPLETION_PATH="/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash"
    fi
    else
    GIT_COMPLETION_PATH="/usr/share/git/completion/git-completion.bash"
    fi
  4. zaps166 revised this gist Feb 4, 2017. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,12 @@
    getGitInfo()
    {
    branch=$(git symbolic-ref --short HEAD 2> /dev/null)
    if [ ! -e $branch ]; then
    checksum=$(git rev-parse --short HEAD 2> /dev/null)
    if [ ! -e $checksum ]; then
    checksum=$(git rev-parse --short HEAD 2> /dev/null)
    if [ ! -z $checksum ]; then
    branch=$(git symbolic-ref --short HEAD 2> /dev/null)
    if [ ! -z $branch ]; then
    echo -e " ($branch $checksum)"
    else
    echo -e " ($checksum)"
    fi
    fi
    }
  5. zaps166 created this gist Jan 28, 2017.
    24 changes: 24 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    getGitInfo()
    {
    branch=$(git symbolic-ref --short HEAD 2> /dev/null)
    if [ ! -e $branch ]; then
    checksum=$(git rev-parse --short HEAD 2> /dev/null)
    if [ ! -e $checksum ]; then
    echo -e " ($branch $checksum)"
    fi
    fi
    }

    if [ $EUID == 0 ] ; then
    PS1='\[\033[01;31m\][$? \u@\h\[\033[01;36m\] \w\[\033[01;31m\]]\[\033[01;35m\]$(getGitInfo)\[\033[01;31m\]\$\[\033[00m\] '
    else
    PS1='\[\033[01;32m\][$? \u@\h\[\033[01;37m\] \w\[\033[01;32m\]]\[\033[01;35m\]$(getGitInfo)\[\033[01;32m\]\$\[\033[00m\] '
    fi

    OS=$(uname)
    if [ $OS == "Darwin" ]; then
    GIT_COMPLETION_PATH="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash"
    else
    GIT_COMPLETION_PATH="/usr/share/git/completion/git-completion.bash"
    fi
    [ -r $GIT_COMPLETION_PATH ] && . $GIT_COMPLETION_PATH