Now I'm going to walk you through the process of
getting your workspace set up on Mac.
And the process on Linux is similar.
There are also written instructions in the instructor notes.
If you're using Windows, there are instructions in the previous video.
First I'm going to download two files that are needed for
the set up I just showed you, one to enable tab completion, and
want to enable the special Git features in the prompt.
So I'll go to the webpage with the first file and
you can find the link to this file in the instructor's notes.
Then I'll right-click anywhere on the page and select Save As.
And I'll save the file in my Downloads directory.
Now I want to make sure that Hide extension is unchecked, so
that I can see the exact name the file is being given.
And by default, it's suggesting Redirecting.txt.
But I want to change this to git-completion.bash, and
then I'll Save the file.
Now I want to move the file to my home directory,
which I'll do using the Terminal.
Now when I first open the Terminal, I start out in my home directory, or
I can type cd ~ to get to the home directory if I need to.
Now I'll use the command mv, which stands for
move, to move the file I just saved into my home directory.
The first argument is the file I want to move,
which is in my Downloads directory and it's named git-completion.bash.
And I want to move it into the current directory while keeping the same name.
Then I'll go through the same process to save the second file linked in
the instructor's notes as git-prompt.sh.
Next, I'm going to create a file called .bash_profile,
which contains configuration for the Terminal.
I recommend using the configuration file that I used when filming this course.
To do that, you can download the file called bash_profile_course in
the downloadables section.
Next, use the Terminal to move this file to your home directory.
You should name it .bash_profile and don't forget the dot at the beginning.
Now if you already have a bash profile, then don't run this command, and
instead you can copy and
paste the content from this file into your existing bash profile.
And if you're running Linux,
then you might need to name this file .bashrc instead of .bash_profile.
Now I don't see any changes made to my prompt yet, and that's because I'll
need to close and reopen the Terminal before the changes take effect.
I'll do that at the the end of the video.
In case you're curious about what's in this bash profile, or
if you'd like to pick and
choose just the lines you're interested in, I'll go through what each line does.
Now, don't worry if you don't understand how each line works though.
Even experienced Unix programmers frequently copy and paste this kind of
thing from their friends, rather than writing it from scratch.
This first line loads one of the files you downloaded earlier and
enables tab completion.
These lines define some colors, which will be used in your prompt.
This line loads the other file you downloaded earlier.
And it's necessary for
the git related stuff like commit IDs to show up in your prompt.
This line is what makes sure that the asterisk will be shown in your
prompt if you make changes in a git repository.
And this line actually defines what the prompt will be.
The prompt will show your username in purple,
the commit you currently have checked out or other git related stuff in green.
And the director URN followed by a dollar sign in blue.
Then any text after that will be displayed in the default color.
If you're curious to learn more about how prompts work in bash,
check out the link in the instructor's notes, but it's not necessary for
the rest of this course.
Next, it's important to make sure you can launch your favorite text
editor from the Terminal so
that you'll be able to set it as your default editor within git.
I'll show how to do this for Sublime.
If you're using another text editor,
I recommend that you Google to figure out how to use it from the Terminal.
Now, I can launch Sublime from the Terminal by running this long command.
Where this is where Sublime is stored on my computer, but
I'd like to have a shortcut.
To create one I'll use Sublime to add a line to my bash profile.
Files with a dot at the beginning of the name don't usually show up in
file system explorers, so
I'm going to have trouble opening my batch profile with Sublime.
To fix this I'll use the trick of moving my bash profile
to a file without a dot at the beginning of the name.
Then to open the file in Sublime, I'll first navigate to my home directory,
which I can do by pressing Cmd+Shift+H.
And then I'll select the file bash_profile.
Then I'll add this line to it to make the subl command stand for
the same command that you saw me enter earlier.
You can copy and
paste this line from the instructor's notes if you're using Sublime.
Now I'll save the file and
I'll change the name back to have a dot at the beginning using the Terminal.
If I don't do this,
then the bash profile won't take effect when I open the Terminal.
Again, this command won't work until I've restarted the Terminal.
Now I'll configure git to use Sublime as my editor for
things like commit messages.
To do that I'll run git config --global core.editor and
here I need to put in double quotes the command to open my text editor.
For Sublime that's subl -n -w.
Where -n will open Sublime in a new window,
and -w will wait until you close your file before continuing.
If you use a different editor,
you will need to modify this part of the command to use the editor that you like.
See the instructor's notes for more details.
Next I'll run these two git config commands,
which will come in handy later in the course.
Please copy and
paste these commands from the instructor's notes and run them.
Finally I'll close the Terminal and reopen it.
Now I can see that my prompt has changed to become more colorful.
And if I want to view my bash profile using Sublime,
I can run subl .bash_profile.
Remember to close and reopen your Terminal when you're finished, or
your changes won't take effect.