2

The global excludes file is configured in core.excludesFile.

How can I easily edit this file?

Tom Hale
  • 40,825
  • 36
  • 187
  • 242

1 Answers1

0

It's not as simple as it sounds.

If you have set:

excludesFile = ~/.config/git/ignore

Then you have the issue of manually expanding the ~ character, which isn't as easy as you'd hope.

The following alias will do the magic for you:

edit-global-excludes = !"bash -c 'f=$(git config core.excludesFile); \"$EDITOR\" \"${f/#\\~/$HOME}\"' #"

This is equivalent to typing at the shell prompt:

$ bash -c 'f=$(git config core.excludesFile); "$EDITOR" "${f/#\~/$HOME}"' #
Tom Hale
  • 40,825
  • 36
  • 187
  • 242