Giter VIP home page Giter VIP logo

git-colored-branch-status's Introduction

git-colored-branch-status

Shows the branch name and colors based on the current git branch status

  • red --> dirty (untracked or modified files)
  • green --> clean
  • yellow --> semi-dirty, clean branch but unpushed commits

Copied some code from the .bashrc, because login didn't worked.

Requirements

The unix programm tput, usually found at /usr/bin/tput should be installed

Integration into an existing

Assuming you are using bash and you already have a .bashrc or .bash_profile in your HOME directory, simply add a line like this this file to integrate it:

source './.git-colored-branch-status'

Then add the following line to integrate the git_prompt. It is assumed that you define your PS1 in MY_PS1. Here is just an example:

MY_PS1="$NM[$HI\u $SI\w$NM]$IN"
PROMPT_COMMAND='PS1="$MY_PS1$(git_prompt): "'

Do not use PS1 in MY_PSI or directly PROMPT_COMMAND because this will result in an totally unexpected behaviour.

To let the changes have effect, you have to source your .bash_profile or .bashrc file:

source .bash_profile

Color adjustment

See here

Credits/based on:

http://vvv.tobiassjosten.net/bash/dynamic-prompt-with-git-and-ansi-colors/

http://jeditoolkit.com/2010/09/04/git-status-in-bash-prompt.html

git-colored-branch-status's People

Contributors

timbru31 avatar xghostkillerx avatar

Watchers

James Cloos avatar Zack Sheppard avatar

Forkers

vanessadean

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.