Add fancy stuff to your Git prompt


/ Published in: Bash
Save to your folder(s)

Setup default ignores, aliases, colors, completion and bash prompt in Git
These are to be run from Terminal.


Copy this code and paste it in your HTML
  1. # Ignore Crap
  2. git config --global core.excludesfile ~/.gitignore
  3. touch "$HOME/.gitignore"
  4. echo '.DS_Store' >> "$HOME/.gitignore"
  5. echo '._*' >> "$HOME/.gitignore"
  6. echo '.svn' >> "$HOME/.gitignore"
  7. echo '.hg' >> "$HOME/.gitignore"
  8.  
  9. # Shortcuts
  10. git config --global alias.st status
  11. git config --global alias.ci commit
  12. git config --global alias.co checkout
  13. git config --global alias.br branch
  14.  
  15. # Colors? YES!
  16. git config --global color.ui auto
  17.  
  18. # Personal Setup
  19. git config --global user.name "Your Name"
  20. git config --global user.email your_email@your-domain.com
  21.  
  22. # Setup Bash Completion
  23. mkdir -p "$HOME/bin"
  24. export PATH="$HOME/bin:$PATH"
  25. echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bash_profile
  26. cp "$HOME/Downloads/src/git-$GIT_VERSION/contrib/completion/git-completion.bash" ~/bin
  27. echo 'source ~/bin/git-completion.bash' >> ~/.bash_profile
  28.  
  29. # Add the current Git Branch to your Bash Prompt
  30. echo "PS1='[\u@\h \w\$(__git_ps1 \" (%s)\")]\\$ '" >> ~/.bash_profile

URL: http://subtlegradient.com/articles/2008/02/21/install_git_leopard

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.