Thread (7 messages) flat view 7 messages, 3 authors, 2021-01-04

Re: git-dir requires work-tree; documentation improvements for working directory

From: Yaroslav Nikitenko <hidden>
Date: 2021-01-02 19:45:10

2021-01-02 22:12 GMT+03:00, Felipe Contreras [off-list ref]:
Yaroslav Nikitenko wrote:
quoted
I use git to manage my dotfiles with this command:

    git --git-dir=/home/yaroslav/.cfg/ --work-tree=/home/yaroslav
I do precisely the same thing.
quoted
When reading documentation, I noticed two issues.

1) The command doesn't work without --work-tree (even from the top
level directory, which is my home directory).

    [~]$ git --git-dir=/home/yaroslav/.cfg/ status
    fatal: this operation must be run in a work tree
That's weird. It works fine here (although I don't see why I would want
that).
BTW, how do you do that in your case?
If you remove all your configuration does it still fail?
It starts to work when I remove my .cfg/config. I've no idea why it
happens. Here is its contents:

$ more .cfg/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = true
[remote "origin"]
	url = me@myserver:my_working_path
[branch "master"]
	remote = origin
	merge = refs/heads/master

quoted
2) In the man documentation for git > git-dir it's written
"It can be an absolute path or relative path to current working
directory."
I think this can be confused with work-tree. I suggest removing the
word 'working' (and probably add an article 'the' before the
'current', but I'm not a native speaker).
Yes, the article is missing, as for the rest I have no opinion.
quoted
I don't subscribe to the mailing list but hope that I'll receive the
replies.
Don't worry. The git mailing list doesn't munge the Reply-To header, so
any decent MUA will keep you in Cc.
I noted that, thanks.
Cheers.

--
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help