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

Re: how to use git merge -s subtree?

From
Sean <seanlkml@sympatico.ca>
Date
Jan 6, 2008, 08:06 UTC
Message-ID
<BAYC1-PASMTP1079A31936B4563801537DAE4E0@CEZ.ICE>
In-Reply-To
<7vir277jz6.fsf@gitster.siamese.dyndns.org>

On Sat, 05 Jan 2008 18:42:37 -0800 Junio C Hamano <gitster@pobox.com> wrote:

Show 11 quoted lines
> David Soria Parra <sn_@gmx.net> writes:
> 
> > Well yes the history is preserved, but it's not connected to the
> > subdirectory. So you cannot do git-log B/foo.c as git doesnot know where
> > to search it as it thinks
> > it is in /foo.c not in B/foo.c
> 
> The thing is, what you are talking is not about the subtree
> merge strategy, but the fundamental philosophy of git.  Asking
> for "the history of file B/foo.c" does not make any sense, as
> git never tracks history of individual files.
Hi Junio,

Obviously you are making an important point here about the way Git is designed, but I think you misspoke slightly. Asking for the history of a file does make sense. Through path limiting you can ask to see just the subset of history that touched a certain file or directory etc..

In a simple repo where you don't have any subtree merge, with a file /B/foo.c that at some point earlier in the history was renamed from /foo.c, the command "git log --follow B/foo.c" will show changes extending back before the rename. However, that doesn't seem to work across a subtree merge. Obviously there's some technical reason for this that i'm overlooking, but on the surface the two cases seem similar.

It would be nice to be able to do "gitk --follow git-gui.sh" in git.git and
actually see the history of that file.  As it stands now, you have to type
"gitk -- git-gui.sh ../git-gui.sh".  Is there a fundamental reason Git can't
be taught to notice this particular type of subtree merge "rename" and
support --follow type semantics?
 
At least the message you referenced from Linus leaves hope that this may be
possible as it makes the case that this is the type of thing that you can do if
you avoid locking yourself into inadequate rename-tracking data structures.
Sean
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 12 in “how to use git merge -s subtree?”
  1. Miklos VajnaJan 5, 2008
  2. SeanJan 6, 2008
  3. David Soria ParraJan 6, 2008
  4. SeanJan 6, 2008
  5. David Soria ParraJan 6, 2008
  6. Junio C HamanoJan 6, 2008
  7. SeanJan 6, 2008
  8. Junio C HamanoJan 7, 2008
  9. SeanJan 8, 2008
  10. Junio C HamanoJan 8, 2008
  11. Miklos VajnaJan 6, 2008
  12. David Soria ParraJan 6, 2008

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.