Last active
          September 22, 2021 06:29 
        
      - 
      
- 
        Save tambakoo/d46708f94dbabc5e8b96db2c60968c56 to your computer and use it in GitHub Desktop. 
    Show git branch in a zsh terminal
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #IN THE .zshrc DOTFILE, ADD THE FOLLOWING CODE | |
| #git branch stuff | |
| function parse_git_branch() { | |
| git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/(\1)/p' | |
| } | |
| setopt PROMPT_SUBST | |
| export PROMPT='${PWD} $(parse_git_branch) $ ' | |
| #RESULTS IN - | |
| # /Users/himanshu/Desktop/commutatus/climber-api (develop) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment