Chapter 7. Personalizing Git
This chapter covers
- Setting the configuration for a single repository, all of a user’s repositories, or all of a system’s repositories
- Enabling useful configuration settings
- Aliasing, shortening, and chaining Git commands
- Using Git share configuration files between machines
- Showing the current branch in a terminal prompt
In this chapter, you’ll learn about Git shortcuts. Git is a heavily configurable tool. As you’ve seen previously in this book, there are often times where you have multiple behaviors or choices for commands that you can select with flags or by using different commands. You may always want to run a command with a lengthy set of commands, or want to set your preferred difftool or mergetool as a default. These tweaks can be done per repository or globally, and they allow you to maximize productivity when adopting a particular Git workflow.
In section 1.2 and technique 35, you saw how to set some configuration options using git config. You set the user and email address for the initial Git configuration and enabled git rerere to avoid having to resolve the same conflicts multiple times.
You wish to set your Git username in your global Git configuration.
- You don’t need to change to the directory of a particular or any Git repository.
- Run git config --global user.name "Mike McQuaid". There will be no output.