Skip to content

filipebezerra/Git-Bash-Env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git-Bash-Env

Customized configuration for Git Bash such as auto completion, custom colors and editor integration with Sublime Text.

Getting started

You can follow the instructions below or you can watch the explanatory video from Youtube. If you are using Windows environment then go to this video or if you are using Linux or Mac environment then go to this video:

  1. Save this file in your home directory with the name git-completion.bash.
  2. Save this file in your home directory with the name git-prompt.sh.
  3. Save this file in your home directory with the name .bash_profile. If you already have a file in your home directory named .bash_profile, copy the content from this file and paste it at the bottom of your existing .bash_profile.
  4. If you're curious to learn more about how bash prompts work, see this page.

Make sure you can start your editor from Git Bash/terminal

If you use Sublime, you can do this by adding the following line to your .bash_profile:

For Windows environment use:

alias subl="C:/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"

For Mac environment use:

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

For Linux environment use:

alias subl="/opt/Sublime\ Text\ 2/sublime_text"

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 Git Bash.

For Windows environment use:

git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe' -n -w"

For Mac environment use:

git config --global core.editor "'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' -n -w"

For Linux environment use:

git config --global core.editor "'/opt/Sublime Text 2/sublime_text' -n -w"

In the command above, the -n parameter means to Sublime open in a new window and -w parameter means Git will wait you to close Sublime before try to continue.

The final steps for any environment:

git config --global push.default upstream
git config --global merge.conflictstyle diff3

Instead of the first command, you may be able to use the simpler git config --global core.editor "subl -n -w" as shown in the video, but many Udacity students have found this does not work for them.

Restart Git Bash/terminal

You'll need to close and re-open Git Bash/terminal before all your changes take effect.

Udacity references

Sublime Text installation help

About

Customized configuration for Git Bash such as auto completion, custom colors and editor integration with Sublime Text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages