0Pricing
DevOps Bootcamp · Lesson

Customizing Git Configuration

Deep dive into Git's configuration files to set up aliases, custom merge tools, and other preferences.

Customizing Git Configuration is a free DevOps Bootcamp lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Unlock Git's Potential

Welcome to Customizing Git Configuration! Git is incredibly powerful, and you can tailor it to fit your personal workflow and preferences.

This lesson will show you how to set up aliases for shorter commands, configure external merge tools, and tweak various settings to make Git work smarter for you.

Where Git Stores Settings

Git stores its configuration in different places, organized into three main levels. These levels determine the scope and precedence of your settings:

  • System-level: Applies to all users on the machine.
  • Global-level: Applies to a specific user across all their repositories.
  • Local-level: Applies only to the current repository you're working in.

Local settings override global, and global overrides system settings.

Viewing Your Configuration

You can easily inspect your current Git configuration settings using the git config command. This helps you see what's currently active.

To list all settings from all levels:

git config --list

Inspecting Specific Values

If you want to check a specific configuration key, you can provide its name. Git will show you the effective value, considering all precedence rules.

For example, to see your configured user name:

git config user.name

Setting Global Defaults

Global configuration applies to all your Git repositories on your machine. It's the most common place to set your identity (name and email) and other general preferences.

Use the --global flag to apply settings at this level:

git config --global user.name "Jane Doe"
git config --global user.email "jane.doe@example.com"

Project-Specific Settings

Sometimes, you need settings that are unique to a particular project. For instance, you might use a different email for work projects than for personal ones.

By default, git config without a level flag (like --global) sets a local configuration for the current repository:

git config user.email "jane.work@company.com"

Introducing Git Aliases

Tired of typing long Git commands? Aliases are custom shortcuts you can create for frequently used Git commands or sequences of commands.

They save time, reduce typos, and can make your Git workflow much more efficient and enjoyable.

Creating Your First Alias

Let's create a simple alias for git status -s, which shows a short, concise status. We'll call our alias st.

Add this to your global configuration:

git config --global alias.st "status -s"

Using Your New Alias

Now, instead of typing the full command, you can just use your new alias. It's that simple!

Try it out:

git st

Advanced Alias Power

Aliases can be more complex, even combining multiple commands. For example, a common alias for a beautiful Git log output:

git config --global alias.lg "log --oneline --decorate --all --graph"

Other Handy Configurations

Beyond aliases, Git offers many other useful configurations:

  • color.ui true: Enables colorful Git output.
  • push.default current: Sets the default behavior for git push to push the current branch to its upstream branch.
  • core.editor: Specifies your preferred text editor for commit messages and other Git interactions.

Explore the git config --help documentation for more options!

Quick Check: Git Config Levels

Understanding the hierarchy of Git configuration is crucial for managing your settings effectively.

Recap: Master Your Git Setup

Great job! You've learned how to customize your Git environment to suit your needs:

  • Understood the three levels of Git configuration: system, global, and local.
  • Used git config to view and set various preferences.
  • Created powerful aliases to streamline your command-line workflow.
  • Discovered other useful settings like color.ui and push.default.

Personalizing your Git setup can significantly boost your productivity and make your development experience much smoother!

Frequently asked questions

Is the “Customizing Git Configuration” lesson free?

Yes — the full text of “Customizing Git Configuration” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.

What will I learn in “Customizing Git Configuration”?

Deep dive into Git's configuration files to set up aliases, custom merge tools, and other preferences. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Customizing Git Configuration” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Understanding Git Hooks
  2. Pre-commit & Post-merge Hooks
  3. Customizing Git Configuration
  4. Sharing Hooks with Husky
← Back to DevOps Bootcamp