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

gitignore and shared worktrees (was: finding the right remote branch for a commit)

From
MKmartin f krafft <madduck@madduck.net>
Date
Jul 17, 2007, 13:09 UTC
Message-ID
<20070717130936.GA19724@piper.oerlikon.madduck.net>

Sorry for the somewhat late reply, I just found time on the weekend to check out this suggestion by Johannes

  (http://marc.info/?l=git&m=118418927823760&w=2)
also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de> [2007.07.11.2126 +0200]:
Show 14 quoted lines
> Come to think of it, this is maybe what I would have done, but it
> appears to me that this is the _ideal_ use case for worktree:
> 
> In $HOME/gits:
> 
> $ mkdir vim.git && cd vim.git
> $ git --work-tree=$HOME init
> $ cat >> info/exclude < EOF
> *
> !/.vimrc
> EOF
> 
> Then you could do all Git operations like push, fetch, pull, log in 
> $HOME/gits/vim.git, and all editing in $HOME.

This actually seems to work really nicely, but I am somewhat displeased by the gitignore/exclude handling, since it's local. What I want to do is synchronise the vim configuration across many workstations with git, and I don't want to have to modify $GIT_DIR/info/exclude on each machine.

So I am tempted to use .gitignore, but that lives in the worktree, and since the suggestion is to share worktrees between different git repos, I can only ever have one .gitignore file, which would have to list ignores for *all* repos in $HOME/gits, which breaks my head.

Do you have any other idea on how to handle ignores? I guess one alternative is just to ignore git status output altogether, but that's not really nice.

Would people consider honoring .gitignore-* in addition to just .gitignore? Or maybe even honouring .gitignore/*, if .gitignore is a directory, not a file?

Cheers,
-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: madduck.bogus@madduck.net
 
"i like .net for the same reason i like gentoo. it keeps all the
 people with no clue from writing c code, which is much harder for me
 to identify and eliminate from my systems. in the same way that
 gentoo gives those people a place to be that isn't in debian"
                                                    -- andrew suffield
Next: martin f krafft
Message 1 of 3 in “gitignore and shared worktrees (was: finding the right remote branch for a commit)”
  1. martin f krafftJul 17, 2007
  2. gitignore and shared worktrees (resend)martin f krafft, Aug 16, 2007
  3. Johannes SchindelinAug 17, 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.