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

Re: working directory status

From
SSSivanandan Srilakshmanan <ssrilaks@gmail.com>
Date
Nov 18, 2019, 10:40 UTC
Message-ID
<CACKP9ct0AJE94=C32QEH_uD8S8PdGoFeW15oftcf-wifh6hWLA@mail.gmail.com>
In-Reply-To
<xmqqk17x1wvx.fsf@gitster-ct.c.googlers.com>
Hi Hannes, Junio, Eric & Pratyush
Thank you very much for your support. I greatly appreciate your guidance.

It is clear now and it is working well. It is possible to use a local bare repository as a conduit to manage multiple remote repositories.

I had to re-read the https://git-scm.com/docs keeping in mind the guidance given, to get a better handle on it.

For the benefit of anyone else stumbling across this thread.
As mentioned earlier ****  DON'T  ***  set GIR_DIR and GIT_WORK_TREE.

Step 1. create a git repo (bare/non-bare) Step 2. git worktree add --track -b Local_Newfeature_branch1 Local_Newfeature remotes/Lakshman/feature_branch

The above will create a local branch Local_Newfeature_branch1 The above command will also checkout the code into the directory Local_Newfeature.

You can perform all your git command inside the directory Local_Newfeature.
C:\test\Local_Newfeature>git branch
  Local_Newfeature_branch
* Local_Newfeature_branch1
  Local_feature_branch

C:\test\Local_Newfeature>git worktree list C:/GitRepo (bare) C:/test/Local_Newfeature b0a097e [Local_Newfeature_branch1]

Works like a charm. Thank you all very, very very much for your guidance and feedback much appreciated.

Thanks Lakshman

On Mon, Nov 18, 2019 at 6:12 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 37 quoted lines
>
> Johannes Sixt <j6t@kdbg.org> writes:
>
> > ...
> > Do not set GIT_DIR if you do not understand the consequences.
>
> I think the explanation in your earlier message was probably a bit
> more helpful.  If they want to use GIT_DIR, they need to also set
> and export GIT_WORK_TREE.
>
> Of course, with both exported, asking "git branch" for which branch
> is checked out would ask about the working tree that GIT_WORK_TREE
> points at without consulting $(pwd), so it is rather pointless.
> When the user switches to another worktree, both GIT_DIR and
> GIT_WORK_TREE need to be updated to point at appropriate places, so
> it sort of defeats the purpose.
>
> >
> >> C:\test\Local_Newfeature>git worktree list
> >> C:\GitRepo                (bare)
> >> C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]
> >> C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]
> >> C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]
> >
> > I do not know whether it is a sane use-case to have a bare repository
> > and separate worktrees.
> >
> > Do not do that. Make a regular clone with a worktree and create
> > secondary worktrees from there.
>
> As long as GIT_DIR/GIT_WORK_TREE are both set and exported (or both
> unset, a new worktree made out of a bare clone should work just
> fine.  At least that is one of the use case I recall the feature was
> designed to be used in.
>
> Thanks.
>
Previous: Junio C Hamano
Message 11 of 11 in “working directory status”
  1. Sivanandan SrilakshmananNov 17, 2019
  2. Pratyush YadavNov 17, 2019
  3. Sivanandan SrilakshmananNov 17, 2019
  4. Johannes SixtNov 17, 2019
  5. Sivanandan SrilakshmananNov 17, 2019
  6. Johannes SixtNov 17, 2019
  7. Sivanandan SrilakshmananNov 18, 2019
  8. Johannes SixtNov 18, 2019
  9. Eric SunshineNov 18, 2019
  10. Junio C HamanoNov 18, 2019
  11. Sivanandan SrilakshmananNov 18, 2019

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.