Commit 7d9a8dc7 by Emma Jane Committed by Git for Teams

Lesson 4: Adding details on using git config

Added commands to customize the following:

- username (or real name, as you prefer)
- email address
- enable color helpers within the git messages

Added a self-study piece on customizing your command prompt to include
additional color and branch information.
parent d4ff5a71
......@@ -11,7 +11,98 @@ you how to get this setup. There are some resources in the
repository that you've already downloaded (look for the "sample"
files in the directory `resources`).
## Customize Your Command Prompt
There are two types of configuration settings you'll be making when
working with Git: global settings which apply to all repositories
that you work on, and local settings which only apply to the current
repository. An example of a global setting might be your name;
whereas your email might be customized based on personal projects
and work projects.
Global settings are stored in in the file `~/.gitconfig`, local
settings are stored in the file `.git/config` for the specific
repository you are working in. You will always be able to go back
and edit your settings if you want to.
## Identifying Yourself
In order to get credit for your work, you'll need to tell Git who
you are. We'll store this setting globally. As it's a global
setting, you don't need to be in a specific repository to make the
change.
### Lesson Objectives
By the end of this lesson, you will be able to add your name and
email to Git for proper attribution in commit messages.
### Self-Check
When you run the following command, is your name displayed?
`git config --get user.name`
### Summary
`git config --global user.name 'Your Name'`
`git config --global user.email 'me@example.com'`
If you want to make these changes only to the current repository,
replace the parameter `--global` with `--local`.
## Changing the Commit Message Editor
By default, you'll be using Vim. I really like Vim, so that's what
you'll be seeing in the videos. It's a bit hardcore though, so you
might want to change your editor to something else. Note: the commit
will only finish when you QUIT the editor, so you'll want to use
something fairly lightweight.
### Lesson Objectives
By the end of this lesson, you will be able to change the default
text editor for commit messages.
### Self-Check
When you run the following command, is the name of your text editor
displayed?
`git config --get core.editor`
### Summary
To change the text editor for your commit messages, use one of the
following commands as is appropriate for your editor of choice:
`git config --global core.editor mate -w`
`git config --global core.editor subl -n -w`
## Adding Color
Reading huge walls of text can be difficult. We'll add some color
helpers to our command line to make it easier to see what git is
doing.
### Lesson Objectives
By the end of this lesson, you will be able to enable the color
hinting to show branch colors, and diffs by color.
### Self-Check
Within the repository you downloaded for the previous lesson, when
you view the log, are the commit hashes a different color than the
author, date, and commit messages?
`git log`
### Summary
`git config --global color.ui true`
### Lesson Bonus: Customize Your Command Prompt
If you're working from the command line, you get ZERO clues
about what's going on with your files, until you explicitly ask
......@@ -39,8 +130,4 @@ colour, along with the name of the branch, actually suits me
just fine and is less distracting without all the extra
information.
### Lesson Objectives
### Self-Check
### Summary
This as a self-study piece.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment