Skip to content

wang-chen/git

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
img
 
 
 
 
 
 
 
 

GIT Helper

A repo to make git bash environment user-friendly.

Author

Chen Wang

Installation

Linux

Simpley Run

  cd ~
  git clone https://github.com/wang-chen/git.git
  cd git
  ./install.sh && bash

MacOS

  1. Create a file ".bash_profile" in your home folder, if there is one already, skip this step.

  2. For MacOS Catalina (MacOS 10.15) and after:

    2.1, Change your default shell from "/bin/zsh" to "/bin/bash" following this link.

    2.2, Add the following line to your ".bash_profile".

       export BASH_SILENCE_DEPRECATION_WARNING=1
    

    For earlier MacOS version, skip this step.

  3. Run

     cd ~
     git clone https://github.com/wang-chen/git.git
     cd git
     cp .git-prompt.sh ~/
     cp .git-completion.bash ~/
     cat ./.bashrc >> ~/.bash_profile
    

What you get:

1, Git command auto completion and its enviorment will be short.

The bash shell leading will be "user (branch [#*+]) folder $", where "#", "*", and "+" indicate "an init repo", "repo has changes", and "changes staged, but not commited", respectively.

2, For example, when you change directory to a git repo, it will show your current branch.

Alt text

3, When you checkout to another branch:

Alt text

4, When changing something, it will show "*"; when adding it to your repo, it will show "+":

Alt text

5, Checkout back to master branch:

Alt text

6, Note: It doesn't replace your git, it only shows where you are when you use git.

7, If you want to know your current folder path, run:

pwd

To uninstall it:

Simply delete the following lines, located at the end of the file '.bashrc' or ".bash_profile" in your home folder.

  #<--------------------------
  #<--------------------------
  # Add from https://github.com/wang-chen/git.git
  # Enable tab completion
  source ~/git-completion.bash
  # colors!
  green="\[\033[0;32m\]"
  blue="\[\033[0;34m\]"
  purple="\[\033[0;35m\]"
  reset="\[\033[0m\]"

  # Change command prompt
  source ~/git-prompt.sh
  export GIT_PS1_SHOWDIRTYSTATE=1
  # '\u' adds the name of the current user to the prompt
  # '\$(__git_ps1)' adds git-related stuff
  # '\W' adds the name of the current directory
  export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"

  alias ls="ls -G"
  alias ll="ls -al -G"
  #--------------------------->
  #--------------------------->

Acknoledgement:

Udacity

About

Git Helper: A repo to make git bash environment user-friendly.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages