git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[Outreachy] GIT_DIR inherited by shell aliases in linked worktrees

From
IMImmaculate Mecha <immaculatemecha87@gmail.com>
Date
Oct 30, 2026, 13:37 UTC
Message-ID
<CAKUOgLzP0CSwOwLeoSpM94A+XCT2X_cVojHsLugDfw+tBZk9LQ@mail.gmail.com>

I'm considering a small Outreachy contribution around repository environment handling in external shell aliases.

I reproduced the following behaviour:
Create a repository with a linked worktree.
Run an external shell alias from inside that worktree.
Have the alias execute git -C ../TestBaseRepo rev-parse.

The nested command reports the calling worktree's Git directory and common directory, even though --show-toplevel correctly identifies TestBaseRepo.

I traced this to the inherited GIT_DIR variable. Unsetting GIT_DIR before running the nested command makes all three results point to the target repository.

I found the earlier 2020 discussion about GIT_DIR inheritance in aliases, but I'm interested in whether there is still room for a focused contribution, particularly around regression tests for linked worktrees.

Would this be a suitable microproject for Outreachy?
Thank you,
Immaculate Mecha
Next: Priestess
Message 1 of 3 in “[Outreachy] GIT_DIR inherited by shell aliases in linked worktrees”
  1. Immaculate MechaOct 30, 2026
  2. PriestessNov 2, 2026
  3. Immaculate MechaNov 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.