From 72b466a8b30c1deb5b8453023346fdf5ca8c45da Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 18 Feb 2026 15:33:46 -0600 Subject: [PATCH] Add Override Your Project Mise File as a Mise TIL --- README.md | 3 +- mise/override-your-project-mise-file.md | 37 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 mise/override-your-project-mise-file.md diff --git a/README.md b/README.md index df550e7..85e3ecd 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). -_1739 TILs and counting..._ +_1740 TILs and counting..._ See some of the other learning resources I work on: @@ -755,6 +755,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Create Umbrella Task For All Test Tasks](mise/create-umbrella-task-for-all-test-tasks.md) - [List The Files Being Loaded By Mise](mise/list-the-files-being-loaded-by-mise.md) - [Look In Ruby Version Dotfile](mise/look-in-ruby-version-dotfile.md) +- [Override Your Project Mise File](mise/override-your-project-mise-file.md) - [Preserve Color Output For Task Command](mise/preserve-color-output-for-task-command.md) - [Read Existing Dot Env File Into Env Vars](mise/read-existing-dot-env-file-into-env-vars.md) - [Run A Command With Specific Tool Version](mise/run-a-command-with-specific-tool-version.md) diff --git a/mise/override-your-project-mise-file.md b/mise/override-your-project-mise-file.md new file mode 100644 index 0000000..23a742d --- /dev/null +++ b/mise/override-your-project-mise-file.md @@ -0,0 +1,37 @@ +# Override Your Project Mise File + +A project I'm working on has a version-controlled `.mise.toml` file in it. Some +changes were made to that recently that introduce some env vars that conflict +with my setup. If I make edits to that file, then I have a modified version of +`.mise.toml` sitting in my Git working copy. + +``` +# .mise.toml +[env] +CONFIG_SETTING = "project" +``` + +Instead, I can rely on the loading precedence rules of `mise` to override those +project settings with my individual settings. I can do that with the +`.mise.local.toml` file which is played on top of any `mise` configuration from +files further down the precedence chain. + +``` +# .mise.local.toml +[env] +CONFIG_SETTING = "override" +``` + +Assuming I have `mise` setup with my shell environment to automatically load in +these files, I can now check what takes precedence: + +```bash +$ echo $CONFIG_SETTING +override +``` + +Make sure `.mise.local.toml` is included in the `.gitignore` file to avoid +checking in your personal environment overrides. + +To be sure about what files are loaded and in what order, give `mise cfg` a try. +I discuss that in more detail in [List The Files Being Loaded By Mise](list-the-files-being-loaded-by-mise.md).