Skip to main content

Find which file set a Git option

Updated 2 min readMarkdown

Two repositories on the same Mac can behave differently even when you run the same Git command. One of them might set an option in its repository configuration, or a conditional include might apply only to repositories under a particular directory.

Suppose you want to find out which file sets pull.rebase. Run this from the repository you're checking:

git config --show-origin --show-scope --get-all pull.rebase

An example output might look like this:

global  file:/Users/example/.gitconfig  false
local   file:.git/config                true

That tells you where both values came from. For a single-valued setting like this one, Git takes the last value it read. To check what that is without listing the other matches, use --get in place of --get-all. If Git prints nothing and returns status 1, the key wasn't found in the configuration it loaded.

When I switch between projects in vsux, I run the check in the terminal belonging to the repository I'm working on. That matters for conditional includes and local configuration, since changing directories can change which files Git reads. I usually start by inspecting one key. A full configuration dump can include details that don't belong in a public bug report.

vsux is an open-source terminal workspace for Apple Silicon Macs. See the source on GitHub.

This article was prepared with AI assistance.

No comments yet. Be the first to comment.