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

Re: Symbolic link documentation

From
Shawn O. Pearce <spearce@spearce.org>
Date
Sep 20, 2007, 18:11 UTC
Message-ID
<20070920181100.GV3099@spearce.org>
In-Reply-To
<70952A932255A2489522275A628B97C3052E993B@xmb-sjc-233.amer.cisco.com>
"Matt Seitz (matseitz)" <matseitz@cisco.com> wrote:
Show 10 quoted lines
> The git-update-index and git-update-ref manual references are the
> closest to what I was looking for.  Both are more low-level and
> technical than what I was hoping for, and the discussion in
> git-update-index seems targeted primarily at how symlinks are translated
> on file systems that don't support symlinks.
> 
> I guess I was looking for something like the GNU "tar" documentation of
> how symlinks are handled
> (http://www.gnu.org/software/tar/manual/html_node/dereference.html#deref
> erence).

Git never dereferences a symlink that are stored as part of the revision data. The only time we dereference a symlink is when it is used inside of .git/refs, or as .git/HEAD, which is what the git-update-ref manpage was talking about.

So Git handles symlinks in the working tree *without* dereferencing them. Internally we store the target of the symlink, much as tar would store the target of the symlink. There is no way to activate a dereference behavior (--dereference / -h in GNU tar) as typically you want to preseve the symlink as a symlink to the target; its part of your source code.

Maybe this is a good hint that the user manual should have a section on symbolic links. Its obvious to old Git hands that a symlink is nothing more than a file with a slightly different mode, but that may not be obvious to people who are new to Git.

-- 
Shawn.
Previous: Matt Seitz (matseitz)Next: Matt Seitz (matseitz)
Message 5 of 10 in “Symbolic link documentation”
  1. Matt Seitz (matseitz)Sep 20, 2007
  2. Johannes SchindelinSep 20, 2007
  3. Shawn O. PearceSep 20, 2007
  4. Matt Seitz (matseitz)Sep 20, 2007
  5. Shawn O. PearceSep 20, 2007
  6. Matt Seitz (matseitz)Sep 20, 2007
  7. Shawn O. PearceSep 20, 2007
  8. Johannes SchindelinSep 20, 2007
  9. Matt SeitzSep 20, 2007
  10. Shawn O. PearceSep 20, 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.