Skip to content

Instantly share code, notes, and snippets.

@anied
Created January 15, 2020 20:00
Show Gist options
  • Select an option

  • Save anied/71439db6ce65d349f9d5861b739153ee to your computer and use it in GitHub Desktop.

Select an option

Save anied/71439db6ce65d349f9d5861b739153ee to your computer and use it in GitHub Desktop.
Udacity advice on setting Git Bash and on Mac

PC https://classroom.udacity.com/courses/ud775/lessons/2980038599/concepts/33417185870923# Mac https://classroom.udacity.com/courses/ud775/lessons/2980038599/concepts/33331589510923

https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh

https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html

.bashrc / .bash_profile

# 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"

Make sure you can start your editor from the terminal If you use Sublime, you can do this by add the following line to your .bash_profile (you may need to change the path if Sublime is installed in a different location for you):

alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"

Making Git configurations Run the following Git configuration commands. The first one will need to be modified if you are using a text editor other than Sublime, or if Sublime is installed in another location for you. See this page for the correct command for a couple of other popular text editors. For any other editor, you'll need to enter the command you use to launch that editor from the terminal.

git config --global core.editor "'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment