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

Re: What commands can and can not be used with bare repositories?

From
Theodore Tso <tytso@mit.edu>
Date
Dec 31, 2006, 02:12 UTC
Message-ID
<20061231021248.GA26067@thunk.org>
In-Reply-To
<20061231015732.GB5082@spearce.org>
On Sat, Dec 30, 2006 at 08:57:32PM -0500, Shawn Pearce wrote:
Show 7 quoted lines
> Try "git --bare log".  Or "git --git-dir=/path/to log".
>
> Actually most commands work on a bare repository.
> Very few don't: the ones that require a working directory.
> E.g. status/revert/cherry-pick/commit/am/merge/pull.  (You can
> pull from a bare repository, but you cannot run pull *in* a bare
> repository.)

Ah, right. Thanks, I missed the --bare option. It should probably be mentioned in the git-clone man page, instead of only in the top-level git manpage.

Show 9 quoted lines
> > confused, but maybe we could fix that.  What if we were to change "git
> > clone --bare" to create the .git -> . symlink, and then add a check to
> > commands that require a working directory to see if ".git" is a symlink
> > to ., and if so, give an error message, "operation not supported on bare
> > repository"?
> 
> No.  Better would be to make git's repository setup logic
> automatically detect if "." is a Git repository, and if so let the
> commands that work without a working directory run.

That makes sense, although the hueristic for determining whether or not "." is a Git repository might be a little interesting. Say, if there is no containing directory which has a .git directory, and the directories "objects", "info", and "refs" are present?

						- Ted
Previous: Shawn PearceNext: Michael S. Tsirkin
Message 4 of 6 in “What commands can and can not be used with bare repositories?”
  1. Theodore Ts'oDec 31, 2006
  2. J. Bruce FieldsDec 31, 2006
  3. Shawn PearceDec 31, 2006
  4. Theodore TsoDec 31, 2006
  5. Michael S. TsirkinDec 31, 2006
  6. Junio C HamanoDec 31, 2006

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.