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

Re: finding the right remote branch for a commit

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Jul 16, 2007, 09:14 UTC
Message-ID
<20070716091415.GA31186@moooo.ath.cx>
In-Reply-To
<Pine.LNX.4.64.0707160036160.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 22 quoted lines
> On Mon, 16 Jul 2007, Matthias Lederhofer wrote:
> 
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Use
> > 
> >     $ git --work-tree "$HOME" --git-dir . init
> > 
> > instead.
> 
> Why _should_ that be necessary at all?  I _already_ told git that the 
> working tree is somewhere else.  It makes _no sense at all_ to treat the 
> cwd as anything else than the GIT_DIR, when --work-tree but no --git-dir 
> were specified.
>
> > IMHO the --bare flag did not make much sense before the introduction
> > of GIT_WORK_TREE and doesn't after, at least not with the meaning it
> > has: why should 'git --bare' mean to use the repository from cwd?
> 
> To the contrary, it makes tons of sense.  If you want to initialise a bare 
> repository, what _more_ natural way than to say "git init --bare"?  And 
> what _more_ natural place to pick for GIT_DIR than the cwd, when you did 
> not specify --git-dir?

Ah, for git init it makes sense to have the --bare flag and also to use the cwd as GIT_DIR when GIT_WORK_TREE is specified.

> > > [descriptions of bugs, that have been largely ignored]

The last paragraphs were for the second and fourth one (git status/add from outside the working tree): it should be possible to fix this but it might be a bit complicated. And if it is done for a few commands probably all commands should support this.

For the third one (git picks up another git repository even if it is inside a 'detached working tree') I have no idea how to fix this. The working tree cannot be recognized in any way. Maybe you can/should use a symlink to the real repository named .git in this case? But this only works as long as you checkout only one repository in the directory.

Show 5 quoted lines
> > Up to now you are supposed to be in the working tree all the time when 
> > using it.  Therefore I'd call these feature requests rather than bugs :)
> 
> Feature requests? WTF? What reason is there for the _requirement_ to 
> specify a working tree, when git does not make use of it?  Hmm?

Sorry, I don't understand what you mean yet. Where does git require you to specify a working tree?

Previous: Johannes Schindelin
Message 7 of 7 in “finding the right remote branch for a commit”
  1. martin f krafftJul 10, 2007
  2. Johannes SchindelinJul 11, 2007
  3. martin f krafftJul 12, 2007
  4. Jakub NarebskiJul 12, 2007
  5. Matthias LederhoferJul 15, 2007
  6. Johannes SchindelinJul 15, 2007
  7. Matthias LederhoferJul 16, 2007

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.