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

Re: [PATCH] added -C option to chdir() into another directory first

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 27, 2009, 14:21 UTC
Message-ID
<49A7F6DB.7040403@drmicha.warpmail.net>
In-Reply-To
<1235679099-33994-1-git-send-email-kbrint@rufus.net>
kevin brintnall venit, vidit, dixit 26.02.2009 21:11:
> This allows things like 'git -C /somewhere pull' without specifying both
> --work-tree and --git-dir.
> 

I'm afraid you hit a somewhat reoccurring issue here. chdir'ing looks simple, but it has many side effects, such as on relative paths (as Junio pointed out) but also on the order of parsing config. Having -C as a global git option would require dealing with all of these effects.

On the other hand, a shell function can achieve the same very easily. The side effects are left to be dealt with by the user then ;)

Michael
Previous: Junio C Hamano
Message 5 of 5 in “added -C option to chdir() into another directory first”
  1. added -C option to chdir() into another directory firstkevin brintnall, Feb 26, 2009
  2. Junio C HamanoFeb 26, 2009
  3. kevin brintnallFeb 26, 2009
  4. Junio C HamanoFeb 26, 2009
  5. Michael J GruberFeb 27, 2009

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.