Revisions .bashrc Profile Configuration For Colors And Git Branch 3,8/5 4512 reviews

Bash shell configuration for - colored prompt, git branch and info in prompt and drush shortcuts -.bashrc. So that’s why we can see the Git status. In this article, we learnt how to customize Git prompt in Bash prompt using expressions GITPS1.It allows us to see more than the current branch name in Bash prompt: dirty-state, untracked files, stash and upstream.

This documentation includes the following sections:

  • Bash Utilities

Bash Utilities

The following are useful bash utilities to enhance the Git experience.The utilities will need to be configured in each independent development environment,for example for Cygwin, Linux, Git Bash, and each virtual machine that may be configured.

Use of the git-completion.sh and git-prompt.sh tools is described in the following Udacity Git training course:Udacity: How to Use Git and GitHub

The git-completion and git-prompt scripts can be enabled in the software developer's.bashrc file (executed for interactive shells),where the .bashrc should be sourced from the .bash_profile or .profile.The following calls the git-completion.bash and git-prompt.shscripts that are described in the following subsections.The following example illustrates saving the scripts in the user's ~/home/bin folder but thescripts could also be named with a leading period and be saved in the home folder as a hidden file(developer needs to decide how to configure their environment).Local modifications can be made by the developer, for example to customize the prompt content and colors.Git for Windows (Git Bash) may already include the following scriptsand therefore modifications are only needed if default behavior is not as desired.

The functionality has been tested in Cygwin, Git Bash, and Debian Linux.

Adobe cs6 master collection keygen. On Debian Linux, the following can be inserted in the .profile (may be included by default):

Then insert the following in the .bashrc file:

The resulting command prompt appears similar to the following:

Auto-Completion with git-completion.bash

The complete example in the previous section uses the git-completion.bash scriptto enable auto-completion of Git commands. See the following original sources describing this script:

  • git-completion.bash - save to the ~/bin folder to enable consistent with the above configuration

Set Prompt to Indicate Repository Information with git-prompt.sh

It can be confusing to know what branch is being edited with command-line tools,especially after being away from a project for awhile. The git-prompt.sh shell script provides context by showing the Git branch in the shell prompt.The following provides the original git-prompt.sh script:

  • git-prompt.sh - save to the ~/bin folder to enable consistent with the above configuration

Bash-profileThis repo contains bash profiling specifics, such as color control or PS1 manipulation, that can be shared with other to increase productivity. It is suggested to link the default user files (/.bashprofile, /.bashlogin, and /.profile) to the files in this repo (/bashprofile, /bashlogin, and /profile, respectively) then simply update the files in the repo. Please consider that other users may be using these as well, so please keep the configurations as portable as possible./setup.sh has been provided to conveniently do the initial symlink setup. InstallationTo install these bash profiling files, run setup.sh.

This will backup anything that may be in it's way (in /.bak), then create symlinks into this repository so you can keep your bash profile updated with just a git pull.