[BUG] `just -g`, `just --global-justfile` and `just --justfile ~/.justfile --working-directory .` calling local justfile instead of global or referenced justfile.
Setting up a global alias is leading to an error, am following the manual on this.
alias .j='just --justfile ~/.justfile --working-directory .'
But when running in a dir without a justfile it works fine.
Running that alias when in a dir that has a just file, it picksup the wrong justfile it picksup the local one instead of the one referenced by --justfile.
My local one, I mean the justfile in the pwd ./justfile
If I remove --working-directory . it works okay but then I can't use commands in ~/.justfile to target the local directory.
Followed: https://just.systems/man/en/global-and-user-justfiles.html
Also tried just --global-justfile and just -g both of which call the local justfile not the global one.
Debug Information: Operating System: Darwin Steves-MacBook-Pro-2.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041 arm64 macOS 15.4.1
Just Version: just 1.39.0
Shell: /bin/zsh
@casey any thoughts here, if you agree with the but I am happy to investigate and try and put a PR together.
I'm using just 1.40.0. When I call just -g from directory containing another justfile, this is the pitfall I ran into:
My global justfile contained default command just --list --unsorted. As you might notice, it lacks -g flag. This means, that my global justfile was executing the local one for the default command, because the -g flag was missing.
# ~/.config/just/justfile
@help:
just -g --list --unsorted
alias default := help
pwd:
echo "Working dir: $(pwd)"
Warning in the docs (Global and User justfiles) should help to avoid confusion.
@smorin I hope that will solve your problem
@theinfinit that helps
I am unable to reproduce this. I'm assuming that the issue was the one pointed out by @theinfinit, with a recursive call to just.
Yes it was the recursive call to just, double checked an missed it.
Steve Morin | Entrepreneur, Engineering Leader, Startup Advisor Editor at | https://productivegrowth.substack.com/ twitter.com/SteveMorin ( http://twitter.com/SteveMorin ) | stevemorin.com ( http://stevemorin.com ) Live the dream start a startup. Make the world ... a better place.
On Mon, Jun 30, 2025 at 12:54 PM, Casey Rodarmor < @.*** > wrote:
casey left a comment (casey/ just#2723) ( https://github.com/casey/just/issues/2723#issuecomment-3020507201 )
I am unable to reproduce this. I'm assuming that the issue was the one pointed out by @ theinfinit ( https://github.com/theinfinit ) , with a recursive call to just.
— Reply to this email directly, view it on GitHub ( https://github.com/casey/just/issues/2723#issuecomment-3020507201 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAA6OL7YPUSPJWLR3NNSC7D3GGIWLAVCNFSM6AAAAAB37RLSQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMRQGUYDOMRQGE ). You are receiving this because you were mentioned. Message ID: <casey/just/issues/2723/3020507201 @ github. com>