Giter VIP home page Giter VIP logo

simple-git-prompt's Introduction

Git prompt for Bash

A minimal and customizable Bash script for dynamically retrieving and displaying the current Git branch in the shell prompt.

The script provides two functions, git_return() displays or returns the current branch information and git_set() sets global variable GIT_BRANCH_INFO containing the same value. Both functions can receive the same arguments.

Prompt-example-demonstration

Usage

Arguments

-v : Adds untracked, unstaged, staged, added, deleted, modified files information.

-c : Enables prompt color
-b : Enables bracket color (enables -c).
-U [value]: Sets unchanged repo prompt color with an escape sequence (enables -c).
-M [value]: Sets modified repo prompt color with an escape sequence (enables -c).

-O [value]: Sets opening bracket symbol
-C [value]: Sets closing bracket symbol
-n [value]: Sets untracked info symbol
-u [value]: Sets unstaged info symbol
-s [value]: Sets staged info symbol
-a [value]: Sets added info symbol
-d [value]: Sets deleted info symbol
-m [value]: Sets modified info symbol

-S [value]: Sets the type of info to suppress in verbose mode
	Example:
		-S 'da' # Omits added and deleted file information from prompt

Prompt

  1. Include the script in .bashrc by source path/to/file/bash-git.sh

  2. Either use the function directly in PS1 or set a global variable in .bashrc:

PS1="[...] \$(git_return <ARG1> <ARG2> ...) [...]"

or

PROMPT_COMMAND='git_set <ARG1> <ARG2> ...'
PS1="[...] \$GIT_BRANCH_INFO [...]"

TODO

  • Separately customize information for (un)tracked, (un)staged etc. files
  • Add more complex information and customization (e.g. unstaged modified, staged added files)

simple-git-prompt's People

Contributors

timurci avatar

Watchers

 avatar

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.